Repository navigation
fix: guard empty ObjectScript scanner state - #2800
Conversation
Signed-off-by: wargloom <wargloom@gmail.com>
|
Thanks for opening this — it has been seen, and it is queued. This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence. Current review status: working through a backlog. What that means for this PR, concretely:
Things that will genuinely speed it up whenever review does happen:
If this fixes a bug, a reproduction we can run is worth more than a description of the symptom. Thanks for contributing, and sorry in advance for the wait. |
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
|
Thank you, @WarGloom, and thanks again for #2737 earlier today! This one reviewed cleanly: the guard has exactly the shape we already carry for the crystal, rescript and purescript scanners, both local patches are recorded in MANIFEST.md, the three checksum pins match the new bytes exactly, and the two regression tests cover both halves of the contract. Another grammar regression test landed in the same test file today, so we merged current main into your branch (one signed-off merge commit, eaed3cd; your commit is unchanged). Please pull before pushing to it again. We will merge once the fresh checks are green. |
What does this PR do?
Fixes #2799. Guard zero-length state copies in the vendored ObjectScript routine and UDL external-scanner deserializers. Tree-sitter calls these functions with a NULL buffer and zero length when there is no external scanner state; the unconditional memcpy triggers UBSan even though it copies no bytes. Nonempty copies are unchanged.
Add a regression case for each scanner to the existing grammar regression suite: accept
(NULL, 0), preserve fresh state, and round-trip a nonempty serialized state. Document both local patches for re-vendoring and refresh the three affected vendored-file checksums (two scanners plus manifest).Overlap: #2368 already includes equivalent guards as part of a larger grammar re-vendor for Python bodies. This PR isolates the sanitizer correction and regression coverage so it can be reviewed and merged independently; it does not claim a separate discovery or replace that grammar update.
Validation
6efe33b7: each actual upstream scanner compiled with-fsanitize=undefined -fno-sanitize-recover=allexits 1 ondeserialize(payload, NULL, 0)withnull pointer passed as argument 2(routine line 118, UDL line 122).scripts/lint.sh --ciwith Cppcheck 2.20.0,scripts/security-vendored.sh,scripts/security-audit.sh, test-source clang-format, andgit diff --check. PassedASAN_OPTIONS=detect_leaks=0:detect_stack_use_after_return=0 scripts/test.sh --suites grammar_regression,grammar_labels,grammar_imports CC=clang CXX=clang++: 6 passed, exit 0. This includes both new scanner tests and the existing per-language extraction, label, and import checks. The full unit suite was not run locally; CI remains pending.AI assistance: OpenAI Codex assisted with investigation, implementation, tests, documentation, and validation on behalf of WarGloom. The submitting contributor is responsible for this change.
Checklist
git commit -s)make -f Makefile.cbm test; focused validation specified above)scripts/lint.sh --ci)