Found by the differential fuzzer (fuzz/fuzz_targets/fuzz_sed.rs).
In the C/POSIX locale we select the byte-oriented engine, which rejects
back-references outright. GNU sed supports them in every locale.
$ printf 'aba\n' | LC_ALL=C sed -n '/\(a\)b\1/p'
aba
$ printf 'aba\n' | LC_ALL=C ./target/release/sed -n '/\(a\)b\1/p'
sed: <script argument 1>:1:11: error: invalid regex '(a)b(?:\1)': back-references are not supported in byte mode
# Exit code: 1
The same script works in a UTF-8 locale, so this only affects byte mode:
$ printf 'aba\n' | LC_ALL=en_US.UTF-8 ./target/release/sed -n '/\(a\)b\1/p'
aba
The error comes from src/sed/fast_regex.rs. Until this is fixed the fuzzer
skips scripts using back-references; see KNOWN_ISSUES in
fuzz/fuzz_targets/fuzz_sed.rs.
Found by the differential fuzzer (
fuzz/fuzz_targets/fuzz_sed.rs).In the C/POSIX locale we select the byte-oriented engine, which rejects
back-references outright. GNU sed supports them in every locale.
The same script works in a UTF-8 locale, so this only affects byte mode:
The error comes from
src/sed/fast_regex.rs. Until this is fixed the fuzzerskips scripts using back-references; see
KNOWN_ISSUESinfuzz/fuzz_targets/fuzz_sed.rs.