kkos/oniguruma

Sample pattern and content to trigger error in onig_search?

codesniffer13 opened this issue · 2 comments

I'm adding unit tests to my code to verify my code's handling of an error return from onig_search. I've tried various patterns (like catastrophic backtracking), but none of them are triggering an error.

Do you have a sample regex pattern + content which causes onig_search to return an error code?

kkos commented
  static UChar* pattern = (UChar* )"(a+)+b";
  static UChar* str = (UChar* )"aaaaaaaaaaaaaaaaaaaaaaaa";
  onig_set_retry_limit_in_match(10000000);  // default value

Perfect, thank you!