Problem
JSON.parse uses mutually recursive JsonParser.parseValue / parseArray / parseObject calls without entering the engine call-depth guard. A valid 50,000-level array currently terminates the process with SIGSEGV (exit 139) instead of producing a catchable resource error.
The public entry points also catch every parser error as invalid syntax, which can mask non-syntax failures such as the depth guard or allocator failure as SyntaxError.
This is a denial-of-service and failure-classification boundary for untrusted JSON.
Required outcome
- Apply the existing interpreter stack-depth contract to every recursively parsed JSON value before the native stack can overflow.
- Preserve
error.InvalidasSyntaxError, but propagate resource/host failures without relabeling them as invalid JSON. - Cover deeply nested valid arrays, objects, and mixed containers in normal and TSan builds.
- Verify shallow boundary values still parse, invalid syntax remains
SyntaxError, reviver/source-text semantics remain unchanged, OOM stays failure-atomic, and no input-specific depth shortcut is introduced. - Add a deterministic subprocess witness proving hostile depth cannot crash or hang the engine.
Relationships
Child of #473 and contributes to #493. Related to the bounded-resource requirements in #480.