Skip to content

Commit

Permalink
Remove previous incorrect patch
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipHazel committed Nov 16, 2023
1 parent 741390c commit fdfbcd9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 23 deletions.
8 changes: 2 additions & 6 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,10 @@ restrictions on POSIX classes.
pcre2_dfa_match() misbehaved. PCRE2_FIRSTLINE is now ignored for anchored
patterns.

38. If PCRE2_ENDANCHORED was set and the end of the pattern was reached during
a recursion, pcre2_match() misbehaved and gave the wrong match. For example,
the pattern /|a(?0)/ matched against "aaaa".

39. Add a test for ridiculous ovector offset values to the substring extraction
38. Add a test for ridiculous ovector offset values to the substring extraction
functions.

40. Make OP_REVERSE use IMM2_SIZE for its data instead of LINK_SIZE, for
39. Make OP_REVERSE use IMM2_SIZE for its data instead of LINK_SIZE, for
consistency with OP_VREVERSE.


Expand Down
24 changes: 12 additions & 12 deletions src/pcre2_match.c
Original file line number Diff line number Diff line change
Expand Up @@ -833,18 +833,6 @@ fprintf(stderr, "++ op=%d\n", *Fecode);
case OP_ACCEPT:
case OP_END:

/* Fail if PCRE2_ENDANCHORED is set and the end of the match is not
the end of the subject. After (*ACCEPT) we fail the entire match (at this
position) but backtrack if we've reached the end of the pattern. This
applies whether or not we are in a recursion. */

if (Feptr < mb->end_subject &&
((mb->moptions | mb->poptions) & PCRE2_ENDANCHORED) != 0)
{
if (Fop == OP_END) RRETURN(MATCH_NOMATCH);
return MATCH_NOMATCH; /* (*ACCEPT) */
}

/* Handle end of a recursion. */

if (Fcurrent_recurse != RECURSE_UNSET)
Expand Down Expand Up @@ -883,6 +871,18 @@ fprintf(stderr, "++ op=%d\n", *Fecode);
Fstart_match == mb->start_subject + mb->start_offset)))
RRETURN(MATCH_NOMATCH);

/* Fail if PCRE2_ENDANCHORED is set and the end of the match is not
the end of the subject. After (*ACCEPT) we fail the entire match (at this
position) but backtrack if we've reached the end of the pattern. This
applies whether or not we are in a recursion. */

if (Feptr < mb->end_subject &&
((mb->moptions | mb->poptions) & PCRE2_ENDANCHORED) != 0)
{
if (Fop == OP_END) RRETURN(MATCH_NOMATCH);
return MATCH_NOMATCH; /* (*ACCEPT) */
}

/* We have a successful match of the whole pattern. Record the result and
then do a direct return from the function. If there is space in the offset
vector, set any pairs that follow the highest-numbered captured string but
Expand Down
5 changes: 3 additions & 2 deletions testdata/testinput2
Original file line number Diff line number Diff line change
Expand Up @@ -6041,7 +6041,8 @@ a)"xI
\x0a
abc\x0adef

/|a(?0)/endanchored
aaaa
# This test is currently broken in the interpreter
# /|a(?0)/endanchored
# aaaa

# End of testinput2
6 changes: 3 additions & 3 deletions testdata/testoutput2
Original file line number Diff line number Diff line change
Expand Up @@ -17918,9 +17918,9 @@ No match
abc\x0adef
0: \x0a

/|a(?0)/endanchored
aaaa
0: aaaa
# This test is currently broken in the interpreter
# /|a(?0)/endanchored
# aaaa

# End of testinput2
Error -70: PCRE2_ERROR_BADDATA (unknown error number)
Expand Down

0 comments on commit fdfbcd9

Please sign in to comment.