joni icon indicating copy to clipboard operation
joni copied to clipboard

Enable ability to escape from combinatorial explosion early

Open talevy opened this issue 7 years ago • 4 comments

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?

talevy avatar May 18 '18 01:05 talevy

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 .

nezda avatar May 11 '20 00:05 nezda

These seem like fine things to open up for configuration.

headius avatar May 11 '20 17:05 headius

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.

headius avatar May 11 '20 17:05 headius

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.

headius avatar Oct 28 '21 20:10 headius

Fixed by #67.

headius avatar May 23 '23 15:05 headius

Moved to 2.2.0 because we're also landing some API changes.

headius avatar May 23 '23 16:05 headius