[Pcre-svn] [1221] code/trunk: Fix a crash which occurs when …

Kezdőlap
Üzenet törlése
Szerző: Subversion repository
Dátum:  
Címzett: pcre-svn
Tárgy: [Pcre-svn] [1221] code/trunk: Fix a crash which occurs when the character type of an invalid UTF character is decoded in JIT.
Revision: 1221
          http://www.exim.org/viewvc/pcre2?view=rev&revision=1221
Author:   zherczeg
Date:     2020-02-20 07:42:47 +0000 (Thu, 20 Feb 2020)
Log Message:
-----------
Fix a crash which occurs when the character type of an invalid UTF character is decoded in JIT.


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/src/pcre2_jit_compile.c
    code/trunk/src/pcre2_jit_test.c


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2020-02-16 17:47:14 UTC (rev 1220)
+++ code/trunk/ChangeLog    2020-02-20 07:42:47 UTC (rev 1221)
@@ -63,7 +63,10 @@
 16. The control verb chain list must always be restored when exiting from a
 recurse function in JIT.


+17. Fix a crash which occurs when the character type of an invalid UTF
+character is decoded in JIT.

+
Version 10.34 21-November-2019
------------------------------


Modified: code/trunk/src/pcre2_jit_compile.c
===================================================================
--- code/trunk/src/pcre2_jit_compile.c    2020-02-16 17:47:14 UTC (rev 1220)
+++ code/trunk/src/pcre2_jit_compile.c    2020-02-20 07:42:47 UTC (rev 1221)
@@ -7224,7 +7224,13 @@
 if ((cc[-1] & XCL_NOT) != 0)
   read_char(common, min, max, backtracks, READ_CHAR_UPDATE_STR_PTR);
 else
+  {
+#ifdef SUPPORT_UNICODE
+  read_char(common, min, max, (needstype || needsscript) ? backtracks : NULL, 0);
+#else /* !SUPPORT_UNICODE */
   read_char(common, min, max, NULL, 0);
+#endif /* SUPPORT_UNICODE */
+  }


if ((cc[-1] & XCL_HASPROP) == 0)
{

Modified: code/trunk/src/pcre2_jit_test.c
===================================================================
--- code/trunk/src/pcre2_jit_test.c    2020-02-16 17:47:14 UTC (rev 1220)
+++ code/trunk/src/pcre2_jit_test.c    2020-02-20 07:42:47 UTC (rev 1221)
@@ -1965,6 +1965,8 @@
     { PCRE2_UTF, CI, 0, 0, 0, 4, 8, { "#\xc7\x85#", NULL }, "\x80\x80#\xc7#\xc7\x85#" },
     { PCRE2_UTF, CI, 0, 0, 0, 7, 11, { "#\xc7\x85#", NULL }, "\x80\x80#\xc7\x80\x80\x80#\xc7\x85#" },


+    { PCRE2_UTF | PCRE2_UCP, CI, 0, 0, 0, -1, -1, { "[\\s]", NULL }, "\xed\xa0\x80" },
+
     /* These two are not invalid UTF tests, but this infrastructure fits better for them. */
     { 0, PCRE2_JIT_COMPLETE, 0, 0, 1, -1, -1, { "\\X{2}", NULL }, "\r\n\n" },
     { 0, PCRE2_JIT_COMPLETE, 0, 0, 1, -1, -1, { "\\R{2}", NULL }, "\r\n\n" },