DescriptionRegExpParser: Fix Reset()ting to the end.
The bug would occur when we try to Reset() to a position already at the end.
This happens e.g., when the regexp ends with \u. What used to happen in that
case: 1) Advance past \ and u (to the end) (which wouldn't increase next_pos_
enough) 2) Try to parse 4 hex digits 3) When that failed, Reset() to the
position which should've been at the end but wasn't.
To be able to properly Reset() to a position at the end, we need to allow
next_pos_ to move beyond the end (since position() is next_pos_ - 1).
Minimal repro case:
var r = /foo\u/
r.test("foou") // should be true, was false.
(Note that \u not followed by 4 hex didits should be interpreted as an identity
escape. It already worked unless \u was at the end of the regexp.)
BUG=v8:3756
LOG=NO
Committed: https://crrev.com/978f41a1da57132f97fbfd9b6592cc99689e18ed
Cr-Commit-Position: refs/heads/master@{#25838}
Patch Set 1 #
Total comments: 2
Patch Set 2 : rebased #Patch Set 3 : long lines #
Messages
Total messages: 9 (2 generated)
|