joni
joni copied to clipboard
Enable ability to escape from combinatorial explosion early
Joni's look-ahead/look-behind feature in evaluating regex matches can find themselves in large recursive loops causing things like https://github.com/elastic/elasticsearch/issues/28731 to occur.
It would be nice to be able to enable Config.CEC so that combinatorial explosion heuristically checks can be applied to prevent certain matches to explode things.
The ability to interrupt the engine thread is nice, but it would be great if one did not have to spawn a timer on a separate thread just to watch the engine and prevent it from taking up too many resources.
any thoughts?
Similar to this I'd like to enable https://github.com/jruby/joni/blob/c1911991387b9c898d09706fa2a878094598c2f9/src/org/joni/Config.java#L41
but it isn't configurable. As an interface, these aren't even fields we can change https://stackoverflow.com/a/11070886/689119 .
These seem like fine things to open up for configuration.
FWIW I am guessing these config fields were added with the intent being that they'd eventually be configurable (otherwise why bother hardcoding them to false), so this would be a natural progression for the library.
Anyone want to attempt a PR to add configuration items for these constants? It wouldn't be difficult since we already have some logic for configuration.
Fixed by #67.
Moved to 2.2.0 because we're also landing some API changes.