Fix \) in (*verb) "name" bug.

This commit is contained in:
Philip.Hazel 2015-12-03 18:36:36 +00:00
parent 4a4326638d
commit a7c9027ae6
4 changed files with 31 additions and 2 deletions

View File

@ -376,6 +376,10 @@ of a pattern is no longer transferred to the options that are returned by
PCRE2_INFO_ALLOPTIONS. In fact, this was an anachronism that should have
changed when the effects of those options were all moved to compile time.
109. An escaped closing parenthesis in the "name" part of a (*verb) when
PCRE2_ALT_VERBNAMES was set caused pcre2_compile() to malfunction. This bug
was found by the LLVM fuzzer.
Version 10.20 30-June-2015
--------------------------

View File

@ -2978,6 +2978,7 @@ Arguments:
ptrptr pointer to the input pointer
codeptr pointer to the compiled code pointer
errorcodeptr pointer to the error code
options the options bits
utf TRUE if processing UTF
cb compile data block
@ -3375,10 +3376,29 @@ for (; ptr < cb->end_pattern; ptr++)
{
if ((options & PCRE2_NO_AUTO_CAPTURE) == 0) cb->bracount++;
}
else /* (*something) - just skip to closing ket */
/* (*something) - just skip to closing ket unless PCRE2_ALT_VERBNAMES is
set, in which case we have to process escapes in the string after the
name. */
else
{
ptr += 2;
while (ptr < cb->end_pattern && *ptr != CHAR_RIGHT_PARENTHESIS) ptr++;
while (MAX_255(*ptr) && (cb->ctypes[*ptr] & ctype_word) != 0) ptr++;
if (*ptr == CHAR_COLON)
{
ptr++;
if ((options & PCRE2_ALT_VERBNAMES) != 0)
{
if (process_verb_name(&ptr, NULL, &errorcode, options, utf, cb) < 0)
goto FAILED;
}
else
{
while (ptr < cb->end_pattern && *ptr != CHAR_RIGHT_PARENTHESIS)
ptr++;
}
}
nest_depth--;
}
}

2
testdata/testinput2 vendored
View File

@ -4735,4 +4735,6 @@ a)"xI
/#comment
(?-x):?/extended
/(8(*:6^\x09x\xa6l\)6!|\xd0:[^:|)\x09d\Z\d{85*m(?'(?<1!)*\W[*\xff]!!h\w]*\xbe;/alt_bsux,alt_verbnames,allow_empty_class,dollar_endonly,extended,multiline,never_utf,no_dotstar_anchor,no_start_optimize
# End of testinput2

View File

@ -15054,4 +15054,7 @@ Subject length lower bound = 0
/#comment
(?-x):?/extended
/(8(*:6^\x09x\xa6l\)6!|\xd0:[^:|)\x09d\Z\d{85*m(?'(?<1!)*\W[*\xff]!!h\w]*\xbe;/alt_bsux,alt_verbnames,allow_empty_class,dollar_endonly,extended,multiline,never_utf,no_dotstar_anchor,no_start_optimize
Failed: error 124 at offset 49: letter or underscore expected after (?< or (?'
# End of testinput2