[Pcre-svn] [342] code/trunk: Make (*LIMIT_MATCH=) give an er…

トップ ページ
このメッセージを削除
著者: Subversion repository
日付:  
To: pcre-svn
題目: [Pcre-svn] [342] code/trunk: Make (*LIMIT_MATCH=) give an error and correct offsets for limit syntax errors.
Revision: 342
          http://www.exim.org/viewvc/pcre2?view=rev&revision=342
Author:   ph10
Date:     2015-08-10 17:34:17 +0100 (Mon, 10 Aug 2015)
Log Message:
-----------
Make (*LIMIT_MATCH=) give an error and correct offsets for limit syntax errors.


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/src/pcre2_compile.c
    code/trunk/testdata/testinput2
    code/trunk/testdata/testoutput14
    code/trunk/testdata/testoutput2


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2015-08-10 16:17:10 UTC (rev 341)
+++ code/trunk/ChangeLog    2015-08-10 16:34:17 UTC (rev 342)
@@ -128,7 +128,12 @@


33. Improve the performance of starting single character repetitions in JIT.

+34. (*LIMIT_MATCH=) now gives an error instead of setting the value to 0.

+35. Error messages for syntax errors in *LIMIT_MATCH and *LIMIT_RECURSION now
+give the right offset instead of zero.
+
+
Version 10.20 30-June-2015
--------------------------


Modified: code/trunk/src/pcre2_compile.c
===================================================================
--- code/trunk/src/pcre2_compile.c    2015-08-10 16:17:10 UTC (rev 341)
+++ code/trunk/src/pcre2_compile.c    2015-08-10 16:34:17 UTC (rev 342)
@@ -7941,6 +7941,12 @@
         case PSO_LIMR:
         c = 0;
         pp = skipatstart;
+        if (!IS_DIGIT(ptr[pp]))
+          {
+          errorcode = ERR60;
+          ptr += pp; 
+          goto HAD_ERROR;
+          }    
         while (IS_DIGIT(ptr[pp]))
           {
           if (c > UINT32_MAX / 10 - 1) break;   /* Integer overflow */
@@ -7949,6 +7955,7 @@
         if (ptr[pp++] != CHAR_RIGHT_PARENTHESIS)
           {
           errorcode = ERR60;
+          ptr += pp; 
           goto HAD_ERROR;
           }
         if (p->type == PSO_LIMM) limit_match = c;


Modified: code/trunk/testdata/testinput2
===================================================================
--- code/trunk/testdata/testinput2    2015-08-10 16:17:10 UTC (rev 341)
+++ code/trunk/testdata/testinput2    2015-08-10 16:34:17 UTC (rev 342)
@@ -4399,4 +4399,8 @@


/(?(1)()\983040\2)/

+/(*LIMIT_MATCH=)abc/
+
+/(*CRLF)(*LIMIT_MATCH=)abc/
+
# End of testinput2

Modified: code/trunk/testdata/testoutput14
===================================================================
--- code/trunk/testdata/testoutput14    2015-08-10 16:17:10 UTC (rev 341)
+++ code/trunk/testdata/testoutput14    2015-08-10 16:34:17 UTC (rev 342)
@@ -98,10 +98,10 @@
  3: ee


/(*LIMIT_MATCH=12bc)abc/
-Failed: error 160 at offset 0: (*VERB) not recognized or malformed
+Failed: error 160 at offset 17: (*VERB) not recognized or malformed

/(*LIMIT_MATCH=4294967290)abc/
-Failed: error 160 at offset 0: (*VERB) not recognized or malformed
+Failed: error 160 at offset 24: (*VERB) not recognized or malformed

/(*LIMIT_RECURSION=4294967280)abc/I
Capturing subpattern count = 0

Modified: code/trunk/testdata/testoutput2
===================================================================
--- code/trunk/testdata/testoutput2    2015-08-10 16:17:10 UTC (rev 341)
+++ code/trunk/testdata/testoutput2    2015-08-10 16:34:17 UTC (rev 342)
@@ -14651,4 +14651,10 @@
 /(?(1)()\983040\2)/
 Failed: error 115 at offset 13: reference to non-existent subpattern


+/(*LIMIT_MATCH=)abc/
+Failed: error 160 at offset 14: (*VERB) not recognized or malformed
+
+/(*CRLF)(*LIMIT_MATCH=)abc/
+Failed: error 160 at offset 21: (*VERB) not recognized or malformed
+
# End of testinput2