Skip to content

Fix detach check in ArrayBuffer.prototype.resize #681

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading