From: Fabrice Bellard Date: Sat, 28 Nov 2026 10:03:25 +0000 (+0100) Subject: ArrayBuffer.prototype.transfer(n) with n > maxByteLength throws TypeError instead... X-Git-Url: https://git.kaiwu.me/http/%22../%7B@url%7D?a=commitdiff_plain;h=0e04abf7b97879038bbeaf320f03ca1b3cd2a1b2;p=quickjs.git ArrayBuffer.prototype.transfer(n) with n > maxByteLength throws TypeError instead of RangeError (#630) --- diff --git a/quickjs.c b/quickjs.c index d2be049..0f2a4c2 100644 --- 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;