[Pcre-svn] [767] code/trunk: Fix crash when more than one ki…

Inizio della pagina
Delete this message
Autore: Subversion repository
Data:  
To: pcre-svn
Oggetto: [Pcre-svn] [767] code/trunk: Fix crash when more than one kind of "push" was set in pcre2test.
Revision: 767
          http://www.exim.org/viewvc/pcre2?view=rev&revision=767
Author:   ph10
Date:     2017-05-06 17:56:07 +0100 (Sat, 06 May 2017)
Log Message:
-----------
Fix crash when more than one kind of "push" was set in pcre2test.


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/src/pcre2test.c
    code/trunk/testdata/testinput20
    code/trunk/testdata/testoutput20


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2017-05-06 16:19:39 UTC (rev 766)
+++ code/trunk/ChangeLog    2017-05-06 16:56:07 UTC (rev 767)
@@ -153,7 +153,10 @@


30. Implement (?n: for PCRE2_NO_AUTO_CAPTURE, because Perl now has this.

+31. If more than one of "push", "pushcopy", or "pushtablescopy" were set in
+pcre2test, a crash could occur.

+
Version 10.23 14-February-2017
------------------------------


Modified: code/trunk/src/pcre2test.c
===================================================================
--- code/trunk/src/pcre2test.c    2017-05-06 16:19:39 UTC (rev 766)
+++ code/trunk/src/pcre2test.c    2017-05-06 16:56:07 UTC (rev 767)
@@ -721,12 +721,15 @@
 CTL_POSIX, so it doesn't need its own entries. */


 static uint32_t exclusive_pat_controls[] = {
-  CTL_POSIX  | CTL_HEXPAT,
-  CTL_POSIX  | CTL_PUSH,
-  CTL_POSIX  | CTL_PUSHCOPY,
-  CTL_POSIX  | CTL_PUSHTABLESCOPY,
-  CTL_POSIX  | CTL_USE_LENGTH,
-  CTL_EXPAND | CTL_HEXPAT };
+  CTL_POSIX    | CTL_HEXPAT,
+  CTL_POSIX    | CTL_PUSH,
+  CTL_POSIX    | CTL_PUSHCOPY,
+  CTL_POSIX    | CTL_PUSHTABLESCOPY,
+  CTL_POSIX    | CTL_USE_LENGTH,
+  CTL_PUSH     | CTL_PUSHCOPY,
+  CTL_PUSH     | CTL_PUSHTABLESCOPY,
+  CTL_PUSHCOPY | CTL_PUSHTABLESCOPY,   
+  CTL_EXPAND   | CTL_HEXPAT };


/* Data controls that are mutually exclusive. At present these are all in the
first control word. */

Modified: code/trunk/testdata/testinput20
===================================================================
--- code/trunk/testdata/testinput20    2017-05-06 16:19:39 UTC (rev 766)
+++ code/trunk/testdata/testinput20    2017-05-06 16:56:07 UTC (rev 767)
@@ -31,20 +31,20 @@
 #load testsaved2


 #pop info
-    foofoo             
+    foofoo
     barbar
-    
+
 #pop mark
     C
-\= Expect no match     
-    D 
-    
+\= Expect no match
+    D
+
 #pop
-    AmanaplanacanalPanama   
+    AmanaplanacanalPanama


 #pop info
     metcalfe 33
-    
+
 # Check for an error when different tables are used.


/abc/push,tables=1
@@ -59,12 +59,12 @@

 #pop should give an error
     pqr
-    
+
 /abcd/pushcopy
     abcd
-    
+
 #pop
-    abcd 
+    abcd


#pop should give an error

@@ -71,18 +71,18 @@
 /abcd/push
 #popcopy
     abcd
-    
+
 #pop
-    abcd 
-    
+    abcd
+
 /abcd/push
 #save testsaved1
 #pop should give an error


 #load testsaved1
-#popcopy 
+#popcopy
     abcd
-    
+
 #pop
     abcd


@@ -91,10 +91,18 @@
 /abcd/pushtablescopy
     abcd


-#popcopy 
+#popcopy
     abcd
-    
+
 #pop
-    abcd 
+    abcd


+# Must only specify one of these
+
+//push,pushcopy
+
+//push,pushtablescopy
+
+//pushcopy,pushtablescopy
+
# End of testinput20

Modified: code/trunk/testdata/testoutput20
===================================================================
--- code/trunk/testdata/testoutput20    2017-05-06 16:19:39 UTC (rev 766)
+++ code/trunk/testdata/testoutput20    2017-05-06 16:56:07 UTC (rev 767)
@@ -40,7 +40,7 @@
 Options: dupnames
 Starting code units: b f 
 Subject length lower bound = 6
-    foofoo             
+    foofoo
  0: foofoo
  1: foo
     barbar
@@ -47,18 +47,18 @@
  0: barbar
  1: <unset>
  2: bar
-    
+
 #pop mark
     C
  0: C
  1: C
 MK: A
-\= Expect no match     
-    D 
+\= Expect no match
+    D
 No match, mark = A
-    
+
 #pop
-    AmanaplanacanalPanama   
+    AmanaplanacanalPanama
  0: AmanaplanacanalPanama
  1: <unset>
  2: <unset>
@@ -78,7 +78,7 @@
  0: metcalfe 33
  1: metcalfe
  2: 33
-    
+
 # Check for an error when different tables are used.


 /abc/push,tables=1
@@ -97,13 +97,13 @@
 #pop should give an error
 ** Can't pop off an empty stack
     pqr
-    
+
 /abcd/pushcopy
     abcd
  0: abcd
-    
+
 #pop
-    abcd 
+    abcd
  0: abcd


 #pop should give an error
@@ -113,11 +113,11 @@
 #popcopy
     abcd
  0: abcd
-    
+
 #pop
-    abcd 
+    abcd
  0: abcd
-    
+
 /abcd/push
 #save testsaved1
 #pop should give an error
@@ -124,10 +124,10 @@
 ** Can't pop off an empty stack


 #load testsaved1
-#popcopy 
+#popcopy
     abcd
  0: abcd
-    
+
 #pop
     abcd
  0: abcd
@@ -139,12 +139,23 @@
     abcd
  0: abcd


-#popcopy 
+#popcopy
     abcd
  0: abcd
-    
+
 #pop
-    abcd 
+    abcd
  0: abcd


+# Must only specify one of these
+
+//push,pushcopy
+** Not allowed together: push pushcopy
+
+//push,pushtablescopy
+** Not allowed together: push pushtablescopy
+
+//pushcopy,pushtablescopy
+** Not allowed together: pushcopy pushtablescopy
+
# End of testinput20