Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Issue 802313003: RegExpParser: Fix Reset()ting to the end. (Closed)

Created:
6 years ago by marja
Modified:
6 years ago
CC:
v8-dev
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

RegExpParser: 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+77 lines, -0 lines) Patch
M src/parser.cc View 1 chunk +3 lines, -0 lines 0 comments Download
A test/mjsunit/regress/regress-3756.js View 1 2 1 chunk +74 lines, -0 lines 0 comments Download

Messages

Total messages: 9 (2 generated)
marja
arv, could you have a look at this CL? (This is a prerequisite for the ...
6 years ago (2014-12-15 14:55:38 UTC) #2
mathias
Drive-by non-owner LGTM.
6 years ago (2014-12-15 14:58:18 UTC) #3
arv (Not doing code reviews)
LGTM https://codereview.chromium.org/802313003/diff/1/test/mjsunit/regress/regress-3756.js File test/mjsunit/regress/regress-3756.js (right): https://codereview.chromium.org/802313003/diff/1/test/mjsunit/regress/regress-3756.js#newcode21 test/mjsunit/regress/regress-3756.js:21: assertFalse(r2.test("first\\u")); // This used to return true (which ...
6 years ago (2014-12-15 15:53:45 UTC) #4
marja
thx for review! https://codereview.chromium.org/802313003/diff/1/test/mjsunit/regress/regress-3756.js File test/mjsunit/regress/regress-3756.js (right): https://codereview.chromium.org/802313003/diff/1/test/mjsunit/regress/regress-3756.js#newcode21 test/mjsunit/regress/regress-3756.js:21: assertFalse(r2.test("first\\u")); // This used to return ...
6 years ago (2014-12-16 11:45:52 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/802313003/40001
6 years ago (2014-12-16 11:47:06 UTC) #7
commit-bot: I haz the power
Committed patchset #3 (id:40001)
6 years ago (2014-12-16 12:14:18 UTC) #8
commit-bot: I haz the power
6 years ago (2014-12-17 10:14:05 UTC) #9
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/978f41a1da57132f97fbfd9b6592cc99689e18ed
Cr-Commit-Position: refs/heads/master@{#25838}

Powered by Google App Engine
This is Rietveld 408576698