Skip to content

deps: V8: cherry-pick 8a1da7c84be7 (main) - #10

Draft
maschwenk wants to merge 2 commits into
base-main-f4e89e70from
v8-json-stringify-zone-main
Draft

maschwenk wants to merge 2 commits into
base-main-f4e89e70from
v8-json-stringify-zone-main

Conversation

@maschwenk

Copy link
Copy Markdown
Owner

same fix as the v26.13.0 branch, on nodejs/node main at f4e89e7 (V8 15.6.75.50): cherry-pick of v8/v8@8a1da7c84be7 (https://chromium-review.googlesource.com/c/v8/v8/+/8529766) so JSON.stringify of a big flat string falls back to the slow path instead of aborting with Zone Allocation failed, plus test/pummel/test-json-stringify-large-flat-string.js. refs nodejs#66489

main gets this commit anyway with the V8 15.8 update (nodejs#67070), and Node's V8 guide says not to backport single patches to main, so upstream the v26.x-staging branch is the one that matters. this one is here for the test commit and in case someone wants it on main early

Original commit message:

    [json] Stringify: Bailout to slow-path if a string could exceed max len

    For strings that might require escaping, we calculate a pessimistic max
    length. This allows us to avoid any bounds checks when writing to the
    buffer.
    However this pessimistic max length can be greater than the allowed
    string max length (and even greater than INT_MAX), which could cause
    zone allocation to fail.
    To avoid zone allocation failure, we fall-back to the slow path if the
    pessimistic max length exceeds the allowed string max length.

    Fixed: 568816246
    Change-Id: I496c34084bce56faad740ad4e139373d6d792552
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8529766
    Reviewed-by: Igor Sheludko <ishell@chromium.org>
    Commit-Queue: Patrick Thier <pthier@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#110411}

Refs: v8/v8@8a1da7c
Fixes: nodejs#66489
JSON.stringify() of a flat string of 134217726 two-byte or 268435451
one-byte characters aborted the process with "Zone Allocation failed".
Check that it returns the result, also for an object value and a
property key, and that a result over the maximum string length throws
a RangeError.

Refs: nodejs#66489
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

coder-task-generated Opened by a coding agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant