]> git.kaiwu.me - quickjs.git/commitdiff
fixed DataView resizing
authorFabrice Bellard <fabrice@bellard.org>
Mon, 3 Nov 2025 17:29:10 +0000 (18:29 +0100)
committerFabrice Bellard <fabrice@bellard.org>
Mon, 3 Nov 2025 17:29:10 +0000 (18:29 +0100)
quickjs.c

index 1930c5d08c2a2db31b2cd1b980420a3805831f30..b4020d064fea334f30065fb1523ee0c50035dca5 100644 (file)
--- a/quickjs.c
+++ b/quickjs.c
@@ -55360,7 +55360,12 @@ static void js_array_buffer_update_typed_arrays(JSArrayBuffer *abuf)
         ta = list_entry(el, JSTypedArray, link);
         p = ta->obj;
         if (p->class_id == JS_CLASS_DATAVIEW) {
-            continue;
+            if (ta->track_rab) {
+                if (ta->offset < len)
+                    ta->length = len - ta->offset;
+                else
+                    ta->length = 0;
+            }
         } else {
             p->u.array.count = 0;
             p->u.array.u.ptr = NULL;