Commit Graph

14 Commits

Author SHA1 Message Date
Renata Hodovan
33367bbfc6 Avoid excessive backtracking in regex engine during fuzzing
The regex engine is prone to excessive backtracking, leading to
timeouts, especially while fuzzing.
This commit introduces a backtracking counter and a limit of 1000
backtracking steps. When this limit is exceeded during fuzzing, the
regex engine aborts to prevent excessive backtracking. For this, the
FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION macro is used, as per
suggested by the documentation of libFuzzer.
2024-07-23 14:28:38 +02:00
Fabrice Bellard
36911f0d3a regexp: fix non greedy quantizers with zero length matches 2024-05-30 16:41:37 +02:00
Charlie Gordon
7a2c6f42d4
Improve libunicode and libregexp headers (#288)
- move all `lre_xxx` functions to libunicode
- use flags table `lre_ctype_bits` instead of bitmaps
- simplify `lre_is_space`, `lre_js_is_ident_first` and `lre_js_is_ident_next`
- simplify `simple_next_token`, handle UTF-8 correctly
- simplify `is_let`, remove dead code
2024-05-05 17:47:40 +02:00
Charlie Gordon
12c91df577 Improve surrogate handling readability
- add inline function to test and convert surrogates
  is_surrogate(c), is_hi_surrogate(c), is_lo_surrogate(c),
  get_hi_surrogate(c), get_lo_surrogate(c), from_surrogate(hi, lo)
- use names for BC header offsets and lengths in libregexp.c
- remove strict aliasing violations in `lre_exec_backtrack()`
- pass all context variables to XXX_CHAR macros in `lre_exec_backtrack()`
2024-02-20 00:22:32 +01:00
Charlie Gordon
8d932deb49 Rename regex flag and field utf16 -> unicode
- rename is_utf16 structure member to is_unicode
- rename flag LRE_FLAG_UTF16 as LRE_FLAG_UNICODE
2024-02-19 16:30:08 +01:00
Charlie Gordon
37bd4ae62d Strip trailing spaces 2024-02-10 16:19:17 +01:00
Fabrice Bellard
10fc744ae4 regexp: fixed the zero advance logic in quantifiers (github issue #158) 2024-01-10 14:36:19 +01:00
Fabrice Bellard
af308614a8 fixed regexp case insensitive flag 2024-01-08 18:42:29 +01:00
Fabrice Bellard
20a57f90d7 Implement extended named capture group identifiers (bnoordhuis) 2023-12-09 12:28:51 +01:00
bellard
b1f67dfc1a 2020-11-08 release 2020-11-08 14:30:56 +01:00
bellard
7c312df422 2020-09-06 release 2020-09-06 19:10:15 +02:00
bellard
8900766099 2020-07-05 release 2020-09-06 19:07:30 +02:00
bellard
383e2b06c8 2020-03-16 release 2020-09-06 19:02:03 +02:00
bellard
91459fb672 2020-01-05 release 2020-09-06 18:53:08 +02:00