-
Notifications
You must be signed in to change notification settings - Fork 488
Description
Hi,
I have observed a reliable way to cause a panic, when using search_slots on a regex_automata::meta::regex which was built from a pattern containing a capture group which has zero repetition. i.e. (abc){0}
It panics if the Vec passed in has space for the capture group - which will never be populated because it is inside a zero repetition.
It seems like in general, regex-automata doesn't mind when the Vec has room for more slots than is required - except when the pattern contains this zero-repetition capture group... As can be seen in the Rust Playground link above, it panics...
I know there may seem to be no real use case for supporting patterns with capture groups which essentially are ignored, but there is a reason for the madness, described a little at #1326
thread 'main' (40) panicked at /playground/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/regex-automata-0.4.13/src/dfa/onepass.rs:2576:33:
range end index 4 out of range for slice of length 2
It is legal to pass any number of slots to this routine. If the regex engine would otherwise write a slot offset that doesn’t fit in the provided slice, then it is simply skipped.