Revision: 1167
http://www.exim.org/viewvc/pcre2?view=rev&revision=1167
Author: zherczeg
Date: 2019-09-09 08:12:00 +0100 (Mon, 09 Sep 2019)
Log Message:
-----------
Add underflow check in JIT.
Modified Paths:
--------------
code/trunk/ChangeLog
code/trunk/src/pcre2_jit_compile.c
Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog 2019-09-07 15:27:05 UTC (rev 1166)
+++ code/trunk/ChangeLog 2019-09-09 07:12:00 UTC (rev 1167)
@@ -146,7 +146,10 @@
31. Installed a .gitignore file on a user's suggestion. When using the svn
repository with git (through git svn) this helps keep it tidy.
+32. Add underflow check in JIT which may occure when the value of subject
+string pointer is close to 0.
+
Version 10.33 16-April-2019
---------------------------
Modified: code/trunk/src/pcre2_jit_compile.c
===================================================================
--- code/trunk/src/pcre2_jit_compile.c 2019-09-07 15:27:05 UTC (rev 1166)
+++ code/trunk/src/pcre2_jit_compile.c 2019-09-09 07:12:00 UTC (rev 1167)
@@ -5793,12 +5793,16 @@
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr);
OP1(SLJIT_MOV, TMP3, 0, STR_END, 0);
- OP2(SLJIT_SUB, STR_END, 0, STR_END, 0, SLJIT_IMM, IN_UCHARS(max));
+ OP2(SLJIT_SUB | SLJIT_SET_LESS, STR_END, 0, STR_END, 0, SLJIT_IMM, IN_UCHARS(max));
+ add_jump(compiler, &common->failed_match, JUMP(SLJIT_LESS));
OP2(SLJIT_SUB | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, STR_END, 0, TMP1, 0);
CMOV(SLJIT_GREATER, STR_END, TMP1, 0);
}
else
- OP2(SLJIT_SUB, STR_END, 0, STR_END, 0, SLJIT_IMM, IN_UCHARS(max));
+ {
+ OP2(SLJIT_SUB | SLJIT_SET_LESS, STR_END, 0, STR_END, 0, SLJIT_IMM, IN_UCHARS(max));
+ add_jump(compiler, &common->failed_match, JUMP(SLJIT_LESS));
+ }
SLJIT_ASSERT(range_right >= 0);