You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
grep - a pattern that hits Oniguruma's retry limit panics and aborts (exit 134) #191
A pattern with nested repetition such as ((x+)*)+$ makes Oniguruma give up with ONIGERR_RETRY_LIMIT_IN_MATCH_OVER on a long enough non-matching line. uu_grep turns that
error into a panic!, so grep aborts with SIGABRT (exit 134) and a Rust backtrace hint.
GNU grep with -P reports exceeded PCRE's backtracking limit for that file and exits 2;
with -E GNU simply finds the match.
Exposed by the GNU tests pcre-abort (expects exit 2 and no output) and filename-lineno.pl
(test backtracking-with-file expects exit 2 and a FILE: exceeded PCRE's backtracking limit
diagnostic).
src/matcher.rs:503-514: every negative Oniguruma return value other than ONIG_MISMATCH
panics. search_leftmost, longest_end_at and is_match all go through it, and none of them
can report an error to the searcher:
fnonig_match_result(result:i32) -> Option<usize>{if result >= 0{Some(result asusize)}elseif result == onig_sys::ONIG_MISMATCH{None}else{panic!("Onig: Regex match error: {}",
onig_error_message(result, null()));}}
Test
#[test]fnbacktracking_limit_is_an_error_not_a_panic(){let(_s,mut c) = ucmd();
c.args(&["-P","((m+)*)+$"]).pipe_in(format!("{}n\n","m".repeat(45))).fails_with_code(2).no_stdout().stderr_does_not_contain("panicked");}
Exposed by the GNU grep test suite: pcre-abort, filename-lineno.pl.
Activity