[Pcre-svn] [1588] code/trunk: Fix reported offsets in \k and…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [1588] code/trunk: Fix reported offsets in \k and \g syntax errors.
Revision: 1588
          http://vcs.pcre.org/viewvc?view=rev&revision=1588
Author:   ph10
Date:     2015-08-10 15:09:19 +0100 (Mon, 10 Aug 2015)
Log Message:
-----------
Fix reported offsets in \k and \g syntax errors.


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/pcre_compile.c
    code/trunk/testdata/testoutput2


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2015-08-08 06:02:16 UTC (rev 1587)
+++ code/trunk/ChangeLog    2015-08-10 14:09:19 UTC (rev 1588)
@@ -111,9 +111,13 @@
     binary file, it incorrectly wrote output to stdout.


 29. The JIT compiler did not restore the control verb head in case of *THEN
-    control verbs. This issue was found by Karl Skomski with a custom LLVM fuzzer.
+    control verbs. This issue was found by Karl Skomski with a custom LLVM
+    fuzzer.


+30. Error messages for syntax errors following \g and \k were giving inaccurate 
+    offsets in the pattern.


+
Version 8.37 28-April-2015
--------------------------


Modified: code/trunk/pcre_compile.c
===================================================================
--- code/trunk/pcre_compile.c    2015-08-08 06:02:16 UTC (rev 1587)
+++ code/trunk/pcre_compile.c    2015-08-10 14:09:19 UTC (rev 1588)
@@ -7920,7 +7920,7 @@
         if (*p != (pcre_uchar)terminator)
           {
           *errorcodeptr = ERR57;
-          break;
+          goto FAILED;
           }
         ptr++;
         goto HANDLE_NUMERICAL_RECURSION;
@@ -7935,7 +7935,7 @@
           ptr[1] != CHAR_APOSTROPHE && ptr[1] != CHAR_LEFT_CURLY_BRACKET))
           {
           *errorcodeptr = ERR69;
-          break;
+          goto FAILED;
           }
         is_recurse = FALSE;
         terminator = (*(++ptr) == CHAR_LESS_THAN_SIGN)?


Modified: code/trunk/testdata/testoutput2
===================================================================
--- code/trunk/testdata/testoutput2    2015-08-08 06:02:16 UTC (rev 1587)
+++ code/trunk/testdata/testoutput2    2015-08-10 14:09:19 UTC (rev 1588)
@@ -9135,10 +9135,10 @@
 Failed: subpattern name expected at offset 3


/\k/
-Failed: \k is not followed by a braced, angle-bracketed, or quoted name at offset 2
+Failed: \k is not followed by a braced, angle-bracketed, or quoted name at offset 1

/\kabc/
-Failed: \k is not followed by a braced, angle-bracketed, or quoted name at offset 5
+Failed: \k is not followed by a braced, angle-bracketed, or quoted name at offset 1

/(?P=)/
Failed: subpattern name expected at offset 4
@@ -9186,7 +9186,7 @@
Failed: unknown POSIX class name at offset 3

/(^(a|b\g<-1'c))/
-Failed: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number at offset 15
+Failed: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number at offset 8

 /^(?+1)(?<a>x|y){0}z/
     xzxx
@@ -14098,10 +14098,10 @@
 Failed: group name must start with a non-digit at offset 4


/\g'3gh'/
-Failed: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number at offset 7
+Failed: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number at offset 2

/\g<5fg>/
-Failed: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number at offset 7
+Failed: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number at offset 2

/(?(<4gh>)abc)/
Failed: group name must start with a non-digit at offset 4