Conversation
* test/modules/filters/test_002_sed_ycomp.py: New test suite. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> GitHub: PR apache#678
ycomp() compiles the sed "y/source/dest/" transliterate command by walking
the source and destination strings in lock-step. The first scan loop guards
*tsp against '\0'/'\n', but the second loop reads the destination via *tsp++
with no such guard: it stops only when the source pointer reaches the
delimiter. When the destination string is shorter than the source, tsp runs
past the destination's closing delimiter and the NUL terminator, reading
past the end of the LBSIZE+1 line buffer (commands->linebuf) into adjacent
memory until it happens to hit a matching byte.
The existing size-mismatch check (SEDERR_TSNTSS) already detects this case --
it fires as soon as a destination byte reads back as the delimiter or NUL --
but it only logs and continues, so the over-read proceeds. Make that check
abort compilation (return NULL, as every other error path in ycomp does),
which both fixes the over-read and rejects the malformed command, matching
the behaviour of standard sed ("strings for `y' command are different
lengths").
The sed program is supplied via the OutputSed/InputSed configuration
directives (ACCESS_CONF), so this is a robustness fix for malformed
configuration, not a remotely triggerable issue.
(cherry picked from commit f9e81cc)
notroj
force-pushed
the
pr678-testing
branch
from
September 17, 2026 20:02
c169a33 to
65dea45
Compare
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.
Analysis by @claude:
🤖 Generated with Claude Code