Repository navigation
reject growable SharedArrayBuffer without hooks - #1523
Merged
Merged
Conversation
saghul
reviewed
Jun 2, 2026
| assert(!JS_IsException(ret)); | ||
| JS_FreeValue(ctx, ret); | ||
|
|
||
| ret = eval(ctx, "new SharedArrayBuffer(16, { maxByteLength: 16 })"); |
Contributor
There was a problem hiding this comment.
Should this succeed, since the current size if the same as the max?
| "const u8 = new Uint8Array(sab);" | ||
| "sab.grow(16384);" | ||
| "u8[1024] === 0 && u8.byteLength === 16384"); | ||
| assert(JS_IsBool(ret)); |
Contributor
There was a problem hiding this comment.
Maybe for completeness assert that it's not an exception
jdcaperon
force-pushed
the
jack-sab-grow-hooks
branch
from
June 2, 2026 11:23
3d9ca45 to
520540c
Compare
saghul
approved these changes
Jun 4, 2026
Contributor
|
Thanks! |
social4hyq
pushed a commit
to social4hyq/homebrew-core
that referenced
this pull request
Sep 20, 2026
quickjs-ng 0.15.1 Created-by: HarmonybrewBot Commit-by: HarmonybrewBot Merged-by: HarmonybrewBot Description: Created by `brew bump` --- Created with `brew bump-formula-pr`.<details> <summary>release notes</summary> <pre>## What's Changed * Add an option to print only version info by @mhogomchungu in quickjs-ng/quickjs#1507 * Walk the cause chain when dumping uncaught errors by @saghul in quickjs-ng/quickjs#1509 * Update projects.md by @qr243vbi in quickjs-ng/quickjs#1514 * Actually enable mimalloc in the CMake CLI build by @saghul in quickjs-ng/quickjs#1519 * reject growable SharedArrayBuffer without hooks by @jdcaperon in quickjs-ng/quickjs#1523 ## New Contributors * @mhogomchungu made their first contribution in quickjs-ng/quickjs#1507 * @jdcaperon made their first contribution in quickjs-ng/quickjs#1523 **Full Changelog**: https://github.com/quickjs-ng/quickjs/compare/v0.15.0...v0.15.1</pre> <p>View the full release notes at <a href="https://github.com/quickjs-ng/quickjs/releases/tag/v0.15.1">https://github.com/quickjs-ng/quickjs/releases/tag/v0.15.1</a>.</p> </details> <hr> See merge request: Harmonybrew/homebrew-core!10565
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is AI assisted and human reviewed to the limits of the human, feel free to close and I can re-raise as an issue.
In
quickjs.c,js_array_buffer_constructor3()allowed growableSharedArrayBufferconstruction without SAB allocator hooks.Context
Growable
SharedArrayBufferconstruction could succeed on runtimes created withJS_NewRuntime()when the embedder had not installed SharedArrayBuffer allocator hooks.In that configuration, construction allocated only the initial
byteLength, whileSharedArrayBuffer.prototype.grow()later assumed the backing store coveredmaxByteLengthand only updated the logical byte length.That mismatch could let typed array and DataView access reach beyond the native allocation after growth.
Intent
Fail closed during JS-created growable
SharedArrayBufferconstruction whensab_allocis unavailable.Fixed-length
SharedArrayBufferconstruction remains allowed without hooks. Runtimes that install SAB allocator hooks can still construct and grow SABs backed by the upfrontmaxByteLengthallocation.The C API regression coverage checks the default-runtime rejection path, preserves fixed-length SAB behavior, and verifies hooked-runtime growth exposes zero-filled bytes beyond the initial length.