Repository navigation
[4.x] Reject a maxByteLength the CLR cannot allocate when the ArrayBuffer is built (backport of #4458) - #4468
Open
michaelthyregod wants to merge 1 commit into
Conversation
…ffer is built (backport of sebastienros#4458) (cherry picked from commit 4c51a61)
This branch has not been deployed
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.
Backport of #4458, the follow-up to #4441 (and to its 4.x backport #4463).
On 4.17.0 and
4.x,new ArrayBuffer(0, { maxByteLength: 2 ** 31 - 1 })builds a resizable buffer whose limit can never be reached; the RangeError only comes at the firstresizethat asks for it. TheJsArrayBufferconstructor now compares againstClrLimits.MaxArrayLengthinstead ofint.MaxValue(AllocateArrayBuffer step 9.a), so the 56 values from 2,147,483,592 to2 ** 31 - 1are a RangeError at construction, with V8's messageInvalid array buffer max length. The cherry-pick applied cleanly; the new tests inArrayBufferAllocationLimitTestsare converted from NUnit to xUnit.Verified locally: Jint.Tests 7994 passed / 4 skipped (net10.0) and 7909 / 4 (net472); Jint.Tests.PublicInterface 1967 passed / 9 skipped (net10.0) and 1959 / 9 (net472); Jint.Tests.Test262 102513 passed / 171 skipped; 0 failures.
🤖 Generated with Claude Code