diff --git a/ChangeLog b/ChangeLog index 4152da7..3f0be06 100644 --- a/ChangeLog +++ b/ChangeLog @@ -330,7 +330,7 @@ AC_USE_SYSTEM_EXTENSIONS macro and to test for functions used by the JIT modules. 52. Minor fixed to pcre2grep from Jason Hood: - * fixes some spacing; + * fixed some spacing; * Windows doesn't usually use single quotes, so I've added a define to use appropriate quotes [in an example]; * LC_ALL was displayed as "LCC_ALL"; diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c index a2f9c53..4475236 100644 --- a/src/pcre2_compile.c +++ b/src/pcre2_compile.c @@ -1220,9 +1220,20 @@ BOOL yield = FALSE; *errorcodeptr = 0; -if (allow_sign >= 0 && ptr < ptrend && - (*ptr == CHAR_PLUS || *ptr == CHAR_MINUS)) - sign = (*ptr++ == CHAR_MINUS)? -1 : +1; +if (allow_sign >= 0 && ptr < ptrend) + { + if (*ptr == CHAR_PLUS) + { + sign = +1; + max_value -= allow_sign; + ptr++; + } + else if (*ptr == CHAR_MINUS) + { + sign = -1; + ptr++; + } + } if (ptr >= ptrend || !IS_DIGIT(*ptr)) return FALSE; while (ptr < ptrend && IS_DIGIT(*ptr)) diff --git a/testdata/testinput2 b/testdata/testinput2 index f711fbe..5f7dc6e 100644 --- a/testdata/testinput2 +++ b/testdata/testinput2 @@ -4959,4 +4959,8 @@ a)"xI /abcd/auto_callout abcd\=callout_error=255:2 +/()(\g+65534)/ + +/()(\g+65533)/ + # End of testinput2 diff --git a/testdata/testoutput2 b/testdata/testoutput2 index d23840a..9ad31d4 100644 --- a/testdata/testoutput2 +++ b/testdata/testoutput2 @@ -15446,6 +15446,12 @@ Failed: error 128 at offset 11: assertion expected after (?( or (?(?C) +1 ^^ b Failed: error -37: callout error code +/()(\g+65534)/ +Failed: error 161 at offset 11: group number is too big + +/()(\g+65533)/ +Failed: error 115 at offset 10: reference to non-existent subpattern + # End of testinput2 Error -63: PCRE2_ERROR_BADDATA (unknown error number) Error -62: bad serialized data