Repository navigation
sed: fix panics and zero steps in ~ and , addresses - #578
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #578 +/- ##
==========================================
- Coverage 83.88% 83.87% -0.01%
==========================================
Files 14 14
Lines 6974 6977 +3
Branches 406 407 +1
==========================================
+ Hits 5850 5852 +2
Misses 1121 1121
- Partials 3 4 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
A range address that ended early made the parser panic: `1~` read past the end of the line, and `1~p`, `1,~p` or `1,p` handed a command letter to the address parser, which only knew how to panic on it. A missing ~step now counts as 0, and a comma with no address after it is reported as an unexpected `,'. The address parser returns an error instead of panicking. A step of 0 was not handled either: `2,~0` ran to the end of the input instead of selecting line 2 alone, and `0~0`, which can select no line, was accepted.
sylvestre
force-pushed
the
fix-range-address-panics
branch
from
September 27, 2026 12:19
befb615 to
d9a3e63
Compare
|
GNU sed testsuite comparison: |
SichenLiang
added a commit
to SichenLiang/sed
that referenced
this pull request
Oct 2, 2026
The substitution and transliteration compilers read the delimiter with ScriptCharProvider::current() even when the command letter was the last character on the line. This indexed past the end of the line and aborted. Check for the end of the line first and report an unterminated command, as GNU sed does. Scripts such as `s`, `1y`, and `p;s` now exit 1 with a diagnostic instead of aborting. The address-parser aborts from uutils#570 were fixed separately in uutils#578.
SichenLiang
added a commit
to SichenLiang/sed
that referenced
this pull request
Oct 5, 2026
The substitution and transliteration compilers read the delimiter with ScriptCharProvider::current() even when the command letter was the last character on the line. This indexed past the end of the line and aborted. Check for the end of the line first and report an unterminated command, as GNU sed does. Scripts such as `s`, `1y`, and `p;s` now exit 1 with a diagnostic instead of aborting. The address-parser aborts from uutils#570 were fixed separately in uutils#578.
sylvestre
pushed a commit
that referenced
this pull request
Oct 6, 2026
The substitution and transliteration compilers read the delimiter with ScriptCharProvider::current() even when the command letter was the last character on the line. This indexed past the end of the line and aborted. Check for the end of the line first and report an unterminated command, as GNU sed does. Scripts such as `s`, `1y`, and `p;s` now exit 1 with a diagnostic instead of aborting. The address-parser aborts from #570 were fixed separately in #578.
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.
A range address that ended early made the parser panic:
1~read past the end of the line, and1~p,1,~por1,phanded a command letter to the address parser, which only knew how to panic on it. A missing ~step now counts as 0, and a comma with no address after it is reported as an unexpected `,'. The address parser returns an error instead of panicking.A step of 0 was not handled either:
2,~0ran to the end of the input instead of selecting line 2 alone, and0~0, which can select no line, was accepted.