Fix two assertion fails in JIT found by Karl Skomski.

This commit is contained in:
Zoltán Herczeg 2015-08-24 09:25:04 +00:00
parent 9150629497
commit 67764372eb
6 changed files with 23 additions and 4 deletions

View File

@ -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
--------------------------

View File

@ -5457,6 +5457,7 @@ sljit_uw typeoffset;
cc++;
ccbegin = cc;
compares = 0;
if (cc[-1] & XCL_MAP)
{
min = 0;
@ -5596,7 +5597,8 @@ 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);
@ -5607,6 +5609,9 @@ 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));
#if PCRE2_CODE_UNIT_WIDTH == 8
if (common->utf)
#endif
JUMPHERE(jump);
}
@ -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);

View File

@ -247,4 +247,6 @@
/[^\xff]((?1))/BI
abcd
/(x(?1)){4}/
# End of testinput17

3
testdata/testinput5 vendored
View File

@ -1659,4 +1659,7 @@
/\C(\W?ſ)'?{{/utf
\\C(\\W?ſ)'?{{
/[\pS#moq]/
=
# End of testinput5

View File

@ -481,4 +481,6 @@ JIT compilation was successful
abcd
Failed: error -46: JIT stack limit reached
/(x(?1)){4}/
# End of testinput17

View File

@ -4060,4 +4060,8 @@ No match
\\C(\\W?ſ)'?{{
No match
/[\pS#moq]/
=
0: =
# End of testinput5