Fix (?R- not being correctly diagnosed.

This commit is contained in:
Philip.Hazel 2015-07-22 09:29:09 +00:00
parent 0046526d0e
commit e4d630c4af
4 changed files with 26 additions and 13 deletions

View File

@ -69,6 +69,9 @@ the LLVM fuzzer.
18. A conditional group with only one branch has an implicit empty alternative 18. A conditional group with only one branch has an implicit empty alternative
branch and must therefore be treated as potentially matching an empty string. branch and must therefore be treated as potentially matching an empty string.
19. If (?R was followed by - or + incorrect behaviour happened instead of a
diagnostic. This bug was discovered by Karl Skomski with the LLVM fuzzer.
Version 10.20 30-June-2015 Version 10.20 30-June-2015
-------------------------- --------------------------

View File

@ -6394,9 +6394,14 @@ for (;; ptr++)
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
case CHAR_R: /* Recursion */ case CHAR_R: /* Recursion, same as (?0) */
ptr++; /* Same as (?0) */ recno = 0;
/* Fall through */ if (*(++ptr) != CHAR_RIGHT_PARENTHESIS)
{
*errorcodeptr = ERR29;
goto FAILED;
}
goto HANDLE_RECURSION;
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */

2
testdata/testinput2 vendored
View File

@ -4354,4 +4354,6 @@ a random value. /Ix
/()(?(R)0)*+/B /()(?(R)0)*+/B
/(?R-:(?</
# End of testinput2 # End of testinput2

View File

@ -14553,4 +14553,7 @@ Failed: error 106 at offset 353: missing terminating ] for character class
End End
------------------------------------------------------------------ ------------------------------------------------------------------
/(?R-:(?</
Failed: error 129 at offset 3: (?R or (?[+-]digits must be followed by )
# End of testinput2 # End of testinput2