Skip to content

fix: add null check to untyped JSON.parse for malformed input#287

Merged
cs01 merged 2 commits intomainfrom
fix/json-parse-null-check
Mar 12, 2026
Merged

fix: add null check to untyped JSON.parse for malformed input#287
cs01 merged 2 commits intomainfrom
fix/json-parse-null-check

Conversation

@cs01
Copy link
Copy Markdown
Owner

@cs01 cs01 commented Mar 12, 2026

Summary

  • Add runtime null check after csyyjson_parse in generateUntypedParse — malformed JSON now prints a clear error and exits instead of dereferencing null
  • Before: JSON.parse("bad") on untyped path → null pointer dereference → segfault
  • After: Error: JSON.parse() failed — invalid JSON input + exit code 1
  • Note: this code path is currently unused (typed parse required by error diagnostic), but guards against future use
  • Completes yyjson null-check audit: all csyyjson_parse call sites now check for null

Test plan

  • npm run verify:quick passes (tests + Stage 1 self-hosting)

🤖 Generated with Claude Code

@cs01 cs01 merged commit ac80edd into main Mar 12, 2026
12 checks passed
@cs01 cs01 deleted the fix/json-parse-null-check branch March 12, 2026 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant