mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-11-29 05:57:07 +02:00
printer: fix panic in replacements in look-around corner case
The abstraction boundary fuck up is the gift that keeps on giving. It turns out that the invariant that the match would never exceed the range given is not always true. So we kludge around it. Also, update the CHANGELOG to include the fix for #2111. Fixes #3180
This commit is contained in:
@@ -1654,3 +1654,16 @@ rgtest!(r3173_hidden_whitelist_only_dot, |dir: Dir, _: TestCommand| {
|
||||
eqnice!(cmd().args(&["--files", "."]).stdout(), "./.foo.txt\n");
|
||||
eqnice!(cmd().args(&["--files", "./"]).stdout(), "./.foo.txt\n");
|
||||
});
|
||||
|
||||
// See: https://github.com/BurntSushi/ripgrep/issues/3180
|
||||
rgtest!(r3180_look_around_panic, |dir: Dir, mut cmd: TestCommand| {
|
||||
dir.create("haystack", " b b b b b b b b\nc\n");
|
||||
|
||||
let got = cmd
|
||||
.arg(r#"(^|[^a-z])((([a-z]+)?)\s)?b(\s([a-z]+)?)($|[^a-z])"#)
|
||||
.arg("haystack")
|
||||
.arg("-U")
|
||||
.arg("-rx")
|
||||
.stdout();
|
||||
eqnice!("xbxbx\n", got);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user