]> git.kaiwu.me - quickjs.git/commitdiff
fixed JS_GetTypedArrayBuffer() length reporting with resizable array buffers (#608)
authorFabrice Bellard <fabrice@bellard.org>
Mon, 9 Nov 2026 14:28:18 +0000 (15:28 +0100)
committerFabrice Bellard <fabrice@bellard.org>
Mon, 9 Nov 2026 14:28:18 +0000 (15:28 +0100)
quickjs.c

index 9c6721794e839cec21e0c749d6159394c63e03e2..8f36a55117d7e3d2ff7bf9e29aaecbe66fe79432 100644 (file)
--- a/quickjs.c
+++ b/quickjs.c
@@ -61535,7 +61535,7 @@ JSValue JS_GetTypedArrayBuffer(JSContext *ctx, JSValueConst obj,
     if (pbyte_offset)
         *pbyte_offset = ta->offset;
     if (pbyte_length)
-        *pbyte_length = ta->length;
+        *pbyte_length = (size_t)p->u.array.count << typed_array_size_log2(p->class_id);
     if (pbytes_per_element) {
         *pbytes_per_element = 1 << typed_array_size_log2(p->class_id);
     }