From 357dfb79640876000b0ad7411939fb98c06ebe73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Herczeg?= Date: Wed, 2 Sep 2015 08:35:50 +0000 Subject: [PATCH] Fix two issues in JIT. --- ChangeLog | 3 +++ src/pcre2_jit_compile.c | 4 ++-- testdata/testinput17 | 5 +++++ testdata/testoutput17 | 14 ++++++++++---- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1222835..3f1fb23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -169,6 +169,9 @@ commas. 48. Implemented PCRE2_ALT_VERBNAMES. +49. Fixed two issues in JIT. These were found by Karl Skomski with a custom +LLVM fuzzer. + Version 10.20 30-June-2015 -------------------------- diff --git a/src/pcre2_jit_compile.c b/src/pcre2_jit_compile.c index 3d2403a..d498fcc 100644 --- a/src/pcre2_jit_compile.c +++ b/src/pcre2_jit_compile.c @@ -3748,6 +3748,7 @@ while (TRUE) } } while (chars[0] != 255 && bytes < bytes_end); + bytes = bytes_end - 32; } consumed++; @@ -9508,8 +9509,7 @@ while (cc < ccend) OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), STR_PTR, 0); } BACKTRACK_AS(braminzero_backtrack)->matchingpath = LABEL(); - if (cc[1] > OP_ASSERTBACK_NOT) - count_match(common); + count_match(common); break; case OP_ONCE: diff --git a/testdata/testinput17 b/testdata/testinput17 index c997cc6..e808ccd 100644 --- a/testdata/testinput17 +++ b/testdata/testinput17 @@ -249,4 +249,9 @@ /(x(?1)){4}/ +/[axm]{7}/ + +/(.|.)*?bx/ + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabax + # End of testinput17 diff --git a/testdata/testoutput17 b/testdata/testoutput17 index bf57b2b..26aeed6 100644 --- a/testdata/testoutput17 +++ b/testdata/testoutput17 @@ -198,7 +198,7 @@ May match empty string Subject length lower bound = 0 JIT compilation was successful /* this is a C style comment */\=find_limits -Minimum match limit = 1 +Minimum match limit = 29 0: /* this is a C style comment */ (JIT) 1: /* this is a C style comment */ @@ -222,17 +222,17 @@ Minimum match limit = 1 /a(?:.)*?a/ims abbbbbbbbbbbbbbbbbbbbba\=find_limits -Minimum match limit = 1 +Minimum match limit = 22 0: abbbbbbbbbbbbbbbbbbbbba (JIT) /a(?:.(*THEN))*?a/ims abbbbbbbbbbbbbbbbbbbbba\=find_limits -Minimum match limit = 1 +Minimum match limit = 22 0: abbbbbbbbbbbbbbbbbbbbba (JIT) /a(?:.(*THEN:ABC))*?a/ims abbbbbbbbbbbbbbbbbbbbba\=find_limits -Minimum match limit = 1 +Minimum match limit = 22 0: abbbbbbbbbbbbbbbbbbbbba (JIT) /^(?>a+)(?>b+)(?>c+)(?>d+)(?>e+)/ @@ -483,4 +483,10 @@ Failed: error -46: JIT stack limit reached /(x(?1)){4}/ +/[axm]{7}/ + +/(.|.)*?bx/ + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabax +Failed: error -47: match limit exceeded + # End of testinput17