fix(grammars): widen uint8_t loop counters in objectscript scanner (CodeQL #69-#72)#1136
Merged
Merged
Conversation
…odeQL) CodeQL cpp/comparison-with-wider-type (4 high-severity alerts, #69-#72) flagged two loops in the vendored ObjectScript scanner (objectscript_common.h, in both the _routine and _udl grammar copies) where a uint8_t counter is compared against an int length: the reverse_marker scan and the html_marker_buffer reversal. Both lengths are hard-bounded by MARKER_BUFFER_MAX_LEN (30), so the uint8_t counter can never wrap and the flagged infinite loop is unreachable in practice — but widening the counters to int removes the pattern and clears the gate. Provably behavior-neutral (int holds every uint8_t value; length <= 30). Recorded as a local modification in the vendored grammar MANIFEST so it is re-applied on the next re-vendor. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
DeusData
enabled auto-merge
July 16, 2026 16:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Clears the 4 open CodeQL
cpp/comparison-with-wider-typealerts (#69, #70, #71, #72, all high severity) onmain.Where
The vendored ObjectScript scanner
objectscript_common.h(identical in both theobjectscript_routineandobjectscript_udlgrammar copies) has two loops that compare auint8_tcounter against anintlength:reverse_markerscan (while (i < reverse_marker_len ...))html_marker_bufferreversal (for (uint8_t i = 0; i < html_marker_buffer_len; i++))Assessment
Unreachable in practice, but fixed for cleanliness. Both lengths are hard-bounded by
MARKER_BUFFER_MAX_LEN = 30, so theuint8_tcounter can never wrap to 0 and the flagged infinite loop cannot occur. The finding is a false positive at these call sites — CodeQL flags the pattern without the buffer-cap context. Widening the two counters tointremoves the pattern and clears the gate; the change is provably behavior-neutral (intholds everyuint8_tvalue, and the length is always ≤ 30).Vendored-code note
These are byte-for-byte-upstream InterSystems grammar files. The widening is recorded as a local modification in
internal/cbm/vendored/grammars/MANIFEST.mdso it is re-applied on the next re-vendor (or upstreamed at intersystems/tree-sitter-objectscript). No other changes to the vendored scanner.Build passes. There's no runtime regression test — the guard is CodeQL itself going green (the fix is a static type widening on an unreachable path).