Make (*LIMIT_MATCH=) give an error and correct offsets for limit syntax errors.
This commit is contained in:
parent
1367ea5c8c
commit
c466cd675e
@ -128,6 +128,11 @@ offsets in the pattern.
|
||||
|
||||
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
|
||||
--------------------------
|
||||
|
@ -7941,6 +7941,12 @@ while (ptr[skipatstart] == CHAR_LEFT_PARENTHESIS &&
|
||||
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 @@ while (ptr[skipatstart] == CHAR_LEFT_PARENTHESIS &&
|
||||
if (ptr[pp++] != CHAR_RIGHT_PARENTHESIS)
|
||||
{
|
||||
errorcode = ERR60;
|
||||
ptr += pp;
|
||||
goto HAD_ERROR;
|
||||
}
|
||||
if (p->type == PSO_LIMM) limit_match = c;
|
||||
|
4
testdata/testinput2
vendored
4
testdata/testinput2
vendored
@ -4399,4 +4399,8 @@ a random value. /Ix
|
||||
|
||||
/(?(1)()\983040\2)/
|
||||
|
||||
/(*LIMIT_MATCH=)abc/
|
||||
|
||||
/(*CRLF)(*LIMIT_MATCH=)abc/
|
||||
|
||||
# End of testinput2
|
||||
|
4
testdata/testoutput14
vendored
4
testdata/testoutput14
vendored
@ -98,10 +98,10 @@ Minimum recursion limit = 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
|
||||
|
6
testdata/testoutput2
vendored
6
testdata/testoutput2
vendored
@ -14651,4 +14651,10 @@ No match
|
||||
/(?(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
|
||||
|
Loading…
Reference in New Issue
Block a user