Fix non-recognition of anchoring when preceded by (*MARK) etc.

This commit is contained in:
Philip.Hazel 2018-11-27 16:00:58 +00:00
parent 9e4e6feee7
commit 0b64d9cfca
4 changed files with 39 additions and 4 deletions

View File

@ -85,6 +85,9 @@ via a string callout.
21. Improve MAP_JIT flag usage on MacOS. Patch by Rich Siegel.
22. If a pattern started with (*MARK), (*COMMIT), (*PRUNE), (*SKIP), or (*THEN)
followed by ^ it was not recognized as anchored.
Version 10.32 10-September-2018
-------------------------------

View File

@ -4615,6 +4615,14 @@ for (;;)
code += GET(code, 1) + 1 + LINK_SIZE;
break;
case OP_MARK:
case OP_COMMIT_ARG:
case OP_PRUNE_ARG:
case OP_SKIP_ARG:
case OP_THEN_ARG:
code += code[1] + PRIV(OP_lengths)[*code];
break;
default:
return code;
}
@ -7486,7 +7494,7 @@ for (;; pptr++)
cb->had_recurse = TRUE;
if (firstcuflags == REQ_UNSET) firstcuflags = REQ_NONE;
zerofirstcu = firstcu;
zerofirstcuflags = firstcuflags;
zerofirstcuflags = firstcuflags;
break;
@ -8641,7 +8649,7 @@ for (;; pptr++)
case META_LOOKBEHIND:
case META_LOOKBEHINDNOT:
case META_NOCAPTURE:
case META_SCRIPT_RUN:
case META_SCRIPT_RUN:
nestlevel++;
break;
@ -9054,7 +9062,7 @@ for (;; pptr++)
case META_ATOMIC:
case META_NOCAPTURE:
case META_SCRIPT_RUN:
case META_SCRIPT_RUN:
pptr++;
CHECK_GROUP:
grouplength = get_grouplength(&pptr, TRUE, errcodeptr, lcptr, group,
@ -9234,7 +9242,7 @@ for (pptr = cb->parsed_pattern; *pptr != META_END; pptr++)
case META_QUERY_QUERY:
case META_RANGE_ESCAPED:
case META_RANGE_LITERAL:
case META_SCRIPT_RUN:
case META_SCRIPT_RUN:
case META_SKIP:
case META_THEN:
break;

6
testdata/testinput2 vendored
View File

@ -5553,4 +5553,10 @@ a)"xI
/foobar/g
the foobar thing foobar again\=copy_matched_subject
/(*:XX)^abc/I
/(*COMMIT:XX)^abc/I
/(*ACCEPT:XX)^abc/I
# End of testinput2

18
testdata/testoutput2 vendored
View File

@ -16875,6 +16875,24 @@ Failed: error 128 at offset 14: assertion expected after (?( or (?(?C)
0: foobar
0: foobar
/(*:XX)^abc/I
Capturing subpattern count = 0
Compile options: <none>
Overall options: anchored
First code unit = 'a'
Subject length lower bound = 3
/(*COMMIT:XX)^abc/I
Capturing subpattern count = 0
Compile options: <none>
Overall options: anchored
First code unit = 'a'
Subject length lower bound = 3
/(*ACCEPT:XX)^abc/I
Capturing subpattern count = 0
Subject length lower bound = 0
# End of testinput2
Error -70: PCRE2_ERROR_BADDATA (unknown error number)
Error -62: bad serialized data