[Pcre-svn] [1411] code/trunk: Fix internal error for XCLASS …

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [1411] code/trunk: Fix internal error for XCLASS in 16/ 32-bit non-UCP versions with heap
Revision: 1411
          http://vcs.pcre.org/viewvc?view=rev&revision=1411
Author:   ph10
Date:     2013-12-06 17:11:44 +0000 (Fri, 06 Dec 2013)


Log Message:
-----------
Fix internal error for XCLASS in 16/32-bit non-UCP versions with heap
recursion, and get rid of some compiler warnings when UCP is not configured.

Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/pcre_compile.c
    code/trunk/pcre_exec.c
    code/trunk/pcre_jit_compile.c
    code/trunk/testdata/testinput17
    code/trunk/testdata/testoutput17


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2013-12-06 16:21:06 UTC (rev 1410)
+++ code/trunk/ChangeLog    2013-12-06 17:11:44 UTC (rev 1411)
@@ -200,6 +200,13 @@


 42. Added support for [[:<:]] and [[:>:]] as used in the BSD POSIX library to
     mean "start of word" and "end of word", respectively, as a transition aid.
+    
+43. A minimizing repeat of a class containing codepoints greater than 255 in
+    non-UTF 16-bit or 32-bit modes caused an internal error when PCRE was 
+    compiled to use the heap for recursion.
+    
+44. Got rid of some compiler warnings for unused variables when UTF but not UCP
+    is configured.



Version 8.33 28-May-2013

Modified: code/trunk/pcre_compile.c
===================================================================
--- code/trunk/pcre_compile.c    2013-12-06 16:21:06 UTC (rev 1410)
+++ code/trunk/pcre_compile.c    2013-12-06 17:11:44 UTC (rev 1411)
@@ -2860,12 +2860,17 @@
   const pcre_uint8 *fcc, pcre_uint32 *list)
 {
 pcre_uchar c = *code;
+pcre_uchar base;
 const pcre_uchar *end;
-const pcre_uint32 *clist_src;
-pcre_uint32 *clist_dest;
 pcre_uint32 chr;
-pcre_uchar base;


+#ifdef SUPPORT_UCP
+pcre_uint32 *clist_dest;
+const pcre_uint32 *clist_src;
+#else
+utf = utf; /* Suppress "unused parameter" compiler warning */
+#endif
+
list[0] = c;
list[1] = FALSE;
code++;

Modified: code/trunk/pcre_exec.c
===================================================================
--- code/trunk/pcre_exec.c    2013-12-06 16:21:06 UTC (rev 1410)
+++ code/trunk/pcre_exec.c    2013-12-06 17:11:44 UTC (rev 1411)
@@ -167,7 +167,7 @@
 {
 PCRE_PUCHAR eptr_start = eptr;
 register PCRE_PUCHAR p = md->start_subject + md->offset_vector[offset];
-#ifdef SUPPORT_UTF
+#if defined SUPPORT_UTF && defined SUPPORT_UCP
 BOOL utf = md->utf;
 #endif


@@ -195,8 +195,7 @@

 if (caseless)
   {
-#ifdef SUPPORT_UTF
-#ifdef SUPPORT_UCP
+#if defined SUPPORT_UTF && defined SUPPORT_UCP
   if (utf)
     {
     /* Match characters up to the end of the reference. NOTE: the number of
@@ -230,7 +229,6 @@
     }
   else
 #endif
-#endif


   /* The same code works when not in UTF-8 mode and in UTF-8 mode when there
   is no UCP support. */
@@ -3075,9 +3073,10 @@
     /* Control never gets here */



-    /* Match an extended character class. This opcode is encountered only
-    when UTF-8 mode mode is supported. Nevertheless, we may not be in UTF-8
-    mode, because Unicode properties are supported in non-UTF-8 mode. */
+    /* Match an extended character class. In the 8-bit library, this opcode is
+    encountered only when UTF-8 mode mode is supported. In the 16-bit and 
+    32-bit libraries, codepoints greater than 255 may be encountered even when 
+    UTF is not supported. */


 #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
     case OP_XCLASS:
@@ -6219,10 +6218,10 @@
   LBL(53) LBL(54) LBL(55) LBL(56) LBL(57) LBL(58) LBL(63) LBL(64)
   LBL(65) LBL(66)
 #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
-  LBL(21)
+  LBL(20) LBL(21)
 #endif
 #ifdef SUPPORT_UTF
-  LBL(16) LBL(18) LBL(20)
+  LBL(16) LBL(18) 
   LBL(22) LBL(23) LBL(28) LBL(30)
   LBL(32) LBL(34) LBL(42) LBL(46)
 #ifdef SUPPORT_UCP


Modified: code/trunk/pcre_jit_compile.c
===================================================================
--- code/trunk/pcre_jit_compile.c    2013-12-06 16:21:06 UTC (rev 1410)
+++ code/trunk/pcre_jit_compile.c    2013-12-06 17:11:44 UTC (rev 1411)
@@ -4023,7 +4023,6 @@
 jump_list *found = NULL;
 jump_list **list = (*cc & XCL_NOT) == 0 ? &found : backtracks;
 pcre_int32 c, charoffset;
-const pcre_uint32 *other_cases;
 struct sljit_jump *jump = NULL;
 pcre_uchar *ccbegin;
 int compares, invertcmp, numberofcmps;
@@ -4032,6 +4031,7 @@
 BOOL needstype = FALSE, needsscript = FALSE, needschar = FALSE;
 BOOL charsaved = FALSE;
 int typereg = TMP1, scriptreg = TMP1;
+const pcre_uint32 *other_cases;
 pcre_int32 typeoffset;
 #endif



Modified: code/trunk/testdata/testinput17
===================================================================
--- code/trunk/testdata/testinput17    2013-12-06 16:21:06 UTC (rev 1410)
+++ code/trunk/testdata/testinput17    2013-12-06 17:11:44 UTC (rev 1411)
@@ -301,4 +301,7 @@


/a*[b-\x{200}]?a#a*[b-\x{200}]?b#[a-f]*[g-\x{200}]*#[g-\x{200}]*[a-c]*#[g-\x{200}]*[a-h]*/BZ

+/^[\x{1234}\x{4321}]{2,4}?/
+    \x{1234}\x{1234}\x{1234}
+
 /-- End of testinput17 --/


Modified: code/trunk/testdata/testoutput17
===================================================================
--- code/trunk/testdata/testoutput17    2013-12-06 16:21:06 UTC (rev 1410)
+++ code/trunk/testdata/testoutput17    2013-12-06 17:11:44 UTC (rev 1411)
@@ -551,4 +551,8 @@
         End
 ------------------------------------------------------------------


+/^[\x{1234}\x{4321}]{2,4}?/
+    \x{1234}\x{1234}\x{1234}
+ 0: \x{1234}\x{1234}
+
 /-- End of testinput17 --/