Missing coverage: Resizable / GrowableSharedArrayBuffers: parameter conversion resizes the underlying buffer
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2.8k
- Forks
- 564
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 10
Description
In most TypedArray.prototype funcs, it's possible that the underlying ArrayBuffer gets resized when we're converting the parameters.
E.g., for TypedArray.prototype.fill:
- Let O be the this value.
- Perform ? ValidateTypedArray(O).
- Let len be O.[[ArrayLength]]. <<< Reading length here
- If O.[[ContentType]] is BigInt, set value to ? ToBigInt(value).
- Otherwise, set value to ? ToNumber(value).
- Let relativeStart be ? ToIntegerOrInfinity(start). <<<< This might resize the buffer
Further, some TypedArray.prototype funcs take a callback as a parameter and that callback might resize the AB.
v8 has tests for these cases here:
https://source.chromium.org/chromium/chromium/src/+/main:v8/test/mjsunit/typedarray-resizablearraybuffer.js;l=1?ss=chromium
(Search for "ParameterConversionResizes" and "GrowMidIteration" / "ShrinkMidIteration".)
Getting this right is security critical, so would be great to have test262 tests.
cc @jugglinmike
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the issue's TypedArray.prototype.fill example and the linked V8 resizablearraybuffer.js tests, searching for “ParameterConversionResizes”, “GrowMidIteration”, and “ShrinkMidIteration”. Add test262 coverage for parameter-conversion and callback cases that resize the underlying ArrayBuffer, and verify the relevant tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100