]> git.kaiwu.me - quickjs.git/commitdiff
ArrayBuffer.prototype.transfer(n) with n > maxByteLength throws TypeError instead...
authorFabrice Bellard <fabrice@bellard.org>
Sat, 28 Nov 2026 10:03:25 +0000 (11:03 +0100)
committerFabrice Bellard <fabrice@bellard.org>
Sat, 28 Nov 2026 10:03:25 +0000 (11:03 +0100)
quickjs.c

index d2be04994ae3c4dcb04d4f47b9f34ecf166ac331..0f2a4c2e5327ffeb7e18f5885ee1300e5e85e1ac 100644 (file)
--- a/quickjs.c
+++ b/quickjs.c
@@ -61330,7 +61330,7 @@ static JSValue js_array_buffer_transfer(JSContext *ctx,
         if (array_buffer_is_resizable(abuf)) { // carry over maxByteLength
             max_len = abuf->max_byte_length;
             if (new_len > max_len)
-                return JS_ThrowTypeError(ctx, "invalid array buffer length");
+                return JS_ThrowRangeError(ctx, "invalid array buffer length");
             // TODO(bnoordhuis) support externally managed RABs
             if (abuf->free_func == js_array_buffer_free)
                 pmax_len = &max_len;