What version of regex are you using?
regex-automata 0.4.14
Describe the bug at a high level.
Panic in BoundedBacktracker::is_match while I'd expect an Err during regex construction time (despite the large size limit). Appeared in the jsonschema crate when I tried to compile all regular expressions I mined from the Open API directory repo.
What are the steps to reproduce the behavior?
use regex_automata::meta::Regex;
let cfg = Regex::config().nfa_size_limit(Some(1_000_000_000));
let re = Regex::builder().configure(cfg).build(r"^.{0,404600}$").unwrap();
re.is_match(""); // panics
What is the actual behavior?
Panic:
thread 'main' panicked at regex-automata-0.4.14/src/meta/wrappers.rs:234:68:
called `Result::unwrap()` on an `Err` value: MatchError(HaystackTooLong { len: 0 })
What is the expected behavior?
I'd expect either a build-time error (like the existing CompiledTooBig for this shape, see #802) or a clean runtime Err - but not a panic:
Regex::builder().configure(cfg).build(r"^.{0,404600}$")
Additionally, HaystackTooLong with len: 0 reads weird as I'd expect some large value there instead of 0 (implied by the TooLong part of the enum variant name).
What version of regex are you using?
regex-automata 0.4.14Describe the bug at a high level.
Panic in
BoundedBacktracker::is_matchwhile I'd expect anErrduring regex construction time (despite the large size limit). Appeared in thejsonschemacrate when I tried to compile all regular expressions I mined from the Open API directory repo.What are the steps to reproduce the behavior?
What is the actual behavior?
Panic:
What is the expected behavior?
I'd expect either a build-time error (like the existing
CompiledTooBigfor this shape, see #802) or a clean runtimeErr- but not a panic:Additionally,
HaystackTooLongwithlen: 0reads weird as I'd expect some large value there instead of0(implied by theTooLongpart of the enum variant name).