-
Notifications
You must be signed in to change notification settings - Fork 235
Closed
Description
I confirmed that this is not related to #156. Discovered by #322.
The pattern (?=x){,2500}
, with x
as any sequence of literals (including none), blows out the JIT compiler stack.
$ ./pcre2test -jit
PCRE2 version 10.43-DEV 2023-04-14 (8-bit)
re> /(?=x){,2500}/
AddressSanitizer:DEADLYSIGNAL
=================================================================
==555324==ERROR: AddressSanitizer: stack-overflow on address 0x7ffe2a1d5cc8 (pc 0x7f77a315f3b1 bp 0x7ffe2a1d6340 sp 0x7ffe2a1d5cd0 T0)
#0 0x7f77a315f3b1 in emit_cum_binary /home/addisoncrump/git/pcre2/./src/sljit/sljitNativeX86_common.c:1816:10
#1 0x7f77a3135145 in sljit_emit_op2 /home/addisoncrump/git/pcre2/./src/sljit/sljitNativeX86_common.c:2478:10
#2 0x7f77a318709e in compile_charn_matchingpath /home/addisoncrump/git/pcre2/src/pcre2_jit_compile.c:9247:3
#3 0x7f77a313f361 in compile_matchingpath /home/addisoncrump/git/pcre2/src/pcre2_jit_compile.c:12399:12
#4 0x7f77a31948af in compile_assert_matchingpath /home/addisoncrump/git/pcre2/src/pcre2_jit_compile.c:10173:3
#5 0x7f77a3140297 in compile_matchingpath /home/addisoncrump/git/pcre2/src/pcre2_jit_compile.c:12526:10
#6 0x7f77a319d222 in compile_bracket_matchingpath /home/addisoncrump/git/pcre2/src/pcre2_jit_compile.c:11062:1
#7 0x7f77a3140650 in compile_matchingpath /home/addisoncrump/git/pcre2/src/pcre2_jit_compile.c:12562:12
#8 0x7f77a319d222 in compile_bracket_matchingpath /home/addisoncrump/git/pcre2/src/pcre2_jit_compile.c:11062:1
#9 0x7f77a3140650 in compile_matchingpath /home/addisoncrump/git/pcre2/src/pcre2_jit_compile.c:12562:12
...
I assume this is a result of lookahead range repetitions being implemented recursively in the JIT compiler. Note that the same occurs with negative lookaheads, lookbehinds, and negative lookbehinds.
Metadata
Metadata
Assignees
Labels
No labels