Skip to content

Commit

Permalink
Fix detach check in ArrayBuffer.prototype.resize
Browse files Browse the repository at this point in the history
  • Loading branch information
bnoordhuis committed Nov 13, 2024
1 parent 2a78706 commit 85ac537
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 2 additions & 2 deletions quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -51975,15 +51975,15 @@ static JSValue js_array_buffer_resize(JSContext *ctx, JSValue this_val,
abuf = JS_GetOpaque2(ctx, this_val, class_id);
if (!abuf)
return JS_EXCEPTION;
if (JS_ToInt64(ctx, &len, argv[0]))
return JS_EXCEPTION;
if (abuf->detached)
return JS_ThrowTypeErrorDetachedArrayBuffer(ctx);
if (!array_buffer_is_resizable(abuf))
return JS_ThrowTypeError(ctx, "array buffer is not resizable");
// TODO(bnoordhuis) support externally managed RABs
if (abuf->free_func != js_array_buffer_free)
return JS_ThrowTypeError(ctx, "external array buffer is not resizable");
if (JS_ToInt64(ctx, &len, argv[0]))
return JS_EXCEPTION;
if (len < 0 || len > abuf->max_byte_length) {
bad_length:
return JS_ThrowRangeError(ctx, "invalid array buffer length");
Expand Down
2 changes: 0 additions & 2 deletions test262_errors.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
test262/test/built-ins/ArrayBuffer/prototype/resize/coerced-new-length-detach.js:15: Test262Error: Expected a TypeError to be thrown but no exception was thrown at all
test262/test/built-ins/ArrayBuffer/prototype/resize/coerced-new-length-detach.js:15: strict mode: Test262Error: Expected a TypeError to be thrown but no exception was thrown at all
test262/test/built-ins/AsyncFromSyncIteratorPrototype/next/iterator-result-poisoned-wrapper.js:64: TypeError: $DONE() not called
test262/test/built-ins/AsyncFromSyncIteratorPrototype/next/iterator-result-poisoned-wrapper.js:64: strict mode: TypeError: $DONE() not called
test262/test/built-ins/AsyncFromSyncIteratorPrototype/next/next-result-poisoned-wrapper.js:69: TypeError: $DONE() not called
Expand Down

0 comments on commit 85ac537

Please sign in to comment.