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
Provide a library API that can limit the amount of backtracking, so
that it can exit gracefully from such expensive cases.
Steps to Reproduce
Attached is a simple script to reproduce this issue. You should be
able to confirm that Onigmo hangs up with:
$ cc-osamplesample.clibonigmo.a
$ ./sample
Expected Solution
PCRE2 provides pcre2_set_match_limit() that allows callers to set a
hard limit on recursive backtracking. If it exceeds the limit, it returns PCRE_ERROR_MATCHLIMIT, aborting the match evaluation.
@k-takata What do you think about Kosako's comment on this thread:
If USE_COMBINATION_EXPLOSION_CHECK flag in src/regint.h enabled, it solves several patterns.
However, it does not solve all pattern cases and it become slow.
Therefore, I was not able to use it.
Problem
Onigmo is a backtracking regex engine. For this reason, it can sometime
become exceptionally slow, in particular, with this class of inputs:
Provide a library API that can limit the amount of backtracking, so
that it can exit gracefully from such expensive cases.
Steps to Reproduce
Attached is a simple script to reproduce this issue. You should be
able to confirm that Onigmo hangs up with:
Expected Solution
PCRE2 provides
pcre2_set_match_limit()
that allows callers to set ahard limit on recursive backtracking. If it exceeds the limit, it returns
PCRE_ERROR_MATCHLIMIT
, aborting the match evaluation.https://www.pcre.org/current/doc/html/pcre2_set_match_limit.html
It would be desriable if Onigmo provides a similar tunable parameter
as well.
Attachment (reproduciable code)
The text was updated successfully, but these errors were encountered: