Make parser reject state sticky after WeaselJson_REJECT #15

Merged
andrew merged 1 commits from weaselbot/weaseljson:weaselbot/issue-12 into main 2026-06-19 17:17:11 +00:00
Member

Closes #12

After the parser returns WeaselJson_REJECT once, subsequent calls to WeaselJsonParser_parse (including the final len == 0 EOF call) now keep returning WeaselJson_REJECT instead of potentially reporting OK.

Changes:

  • Add a rejected flag to Parser3.
  • Clear the flag in reset().
  • Check the flag at the start of parse() and immediately return WeaselJson_REJECT.
  • Set the flag whenever a continuation returns WeaselJson_REJECT.
  • Add a regression test covering the exact reproduction from issue #12.
Closes #12 After the parser returns `WeaselJson_REJECT` once, subsequent calls to `WeaselJsonParser_parse` (including the final `len == 0` EOF call) now keep returning `WeaselJson_REJECT` instead of potentially reporting `OK`. Changes: - Add a `rejected` flag to `Parser3`. - Clear the flag in `reset()`. - Check the flag at the start of `parse()` and immediately return `WeaselJson_REJECT`. - Set the flag whenever a continuation returns `WeaselJson_REJECT`. - Add a regression test covering the exact reproduction from issue #12.
weaselbot added 1 commit 2026-06-19 17:08:34 +00:00
Make parser reject state sticky after WeaselJson_REJECT
CI / pre-commit (pull_request) Successful in 50s
CI / build (-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++, clang-arm64, ubuntu-latest-arm64, true) (pull_request) Successful in 53s
CI / build (-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++, gcc-arm64, ubuntu-latest-arm64, false) (pull_request) Successful in 47s
CI / build (-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++, clang-amd64, ubuntu-latest-amd64, true) (pull_request) Successful in 1m28s
CI / build (-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++, gcc-amd64, ubuntu-latest-amd64, false) (pull_request) Successful in 1m22s
9839104635
After the parser returns WeaselJson_REJECT once, subsequent calls to
WeaselJsonParser_parse (including the final len==0 EOF call) must keep
returning WeaselJson_REJECT instead of potentially reporting OK.

- Add a `rejected` flag to Parser3.
- Clear the flag in reset().
- Check the flag at the start of parse() and immediately return REJECT.
- Set the flag whenever a continuation returns REJECT.

Add a test covering the exact reproduction from issue #12.
weaselbot marked the pull request as ready for review 2026-06-19 17:08:49 +00:00
andrew merged commit 05185eb3ee into main 2026-06-19 17:17:11 +00:00
andrew deleted branch weaselbot/issue-12 2026-06-19 17:17:12 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: weaselab/weaseljson#15