diff --git a/ChangeLog b/ChangeLog index af46dc7..0c79904 100644 --- a/ChangeLog +++ b/ChangeLog @@ -151,6 +151,9 @@ non-zero. 41. Improve first character match in JIT with SSE2 on x86. +42. Fix two assertion fails in JIT. These issues 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 0baeca2..3bfb834 100644 --- a/src/pcre2_jit_compile.c +++ b/src/pcre2_jit_compile.c @@ -5457,6 +5457,7 @@ sljit_uw typeoffset; cc++; ccbegin = cc; compares = 0; + if (cc[-1] & XCL_MAP) { min = 0; @@ -5596,9 +5597,10 @@ else if ((cc[-1] & XCL_MAP) != 0) if (!check_class_ranges(common, (const sljit_ub *)cc, FALSE, TRUE, list)) { #if PCRE2_CODE_UNIT_WIDTH == 8 - SLJIT_ASSERT(common->utf); + jump = NULL; + if (common->utf) #endif - jump = CMP(SLJIT_GREATER, TMP1, 0, SLJIT_IMM, 255); + jump = CMP(SLJIT_GREATER, TMP1, 0, SLJIT_IMM, 255); OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7); OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3); @@ -5607,7 +5609,10 @@ else if ((cc[-1] & XCL_MAP) != 0) OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0); add_jump(compiler, list, JUMP(SLJIT_NOT_ZERO)); - JUMPHERE(jump); +#if PCRE2_CODE_UNIT_WIDTH == 8 + if (common->utf) +#endif + JUMPHERE(jump); } OP1(SLJIT_MOV, TMP1, 0, RETURN_ADDR, 0); @@ -10657,7 +10662,7 @@ static SLJIT_INLINE void compile_recurse(compiler_common *common) DEFINE_COMPILER; PCRE2_SPTR cc = common->start + common->currententry->start; PCRE2_SPTR ccbegin = cc + 1 + LINK_SIZE + (*cc == OP_BRA ? 0 : IMM2_SIZE); -PCRE2_SPTR ccend = bracketend(cc); +PCRE2_SPTR ccend = bracketend(cc) - (1 + LINK_SIZE); BOOL needs_control_head; int framesize = get_framesize(common, cc, NULL, TRUE, &needs_control_head); int private_data_size = get_private_data_copy_length(common, ccbegin, ccend, needs_control_head); diff --git a/testdata/testinput17 b/testdata/testinput17 index 02cc233..c997cc6 100644 --- a/testdata/testinput17 +++ b/testdata/testinput17 @@ -247,4 +247,6 @@ /[^\xff]((?1))/BI abcd +/(x(?1)){4}/ + # End of testinput17 diff --git a/testdata/testinput5 b/testdata/testinput5 index 413ab1a..c2adec5 100644 --- a/testdata/testinput5 +++ b/testdata/testinput5 @@ -1659,4 +1659,7 @@ /\C(\W?ſ)'?{{/utf \\C(\\W?ſ)'?{{ +/[\pS#moq]/ + = + # End of testinput5 diff --git a/testdata/testoutput17 b/testdata/testoutput17 index c2d1a6c..bf57b2b 100644 --- a/testdata/testoutput17 +++ b/testdata/testoutput17 @@ -481,4 +481,6 @@ JIT compilation was successful abcd Failed: error -46: JIT stack limit reached +/(x(?1)){4}/ + # End of testinput17 diff --git a/testdata/testoutput5 b/testdata/testoutput5 index 7422221..4c2410e 100644 --- a/testdata/testoutput5 +++ b/testdata/testoutput5 @@ -4060,4 +4060,8 @@ No match \\C(\\W?ſ)'?{{ No match +/[\pS#moq]/ + = + 0: = + # End of testinput5