New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 876759 link

Starred by 11 users

Issue metadata

Status: Fixed
Owner:
Closed: Oct 9
Cc:
Components:
EstimatedDays: ----
NextAction: 2018-10-03
OS: Linux , Android , Windows , Chrome , Mac
Pri: 1
Type: Bug-Regression



Sign in to add a comment

Regex matching incorrectly cuts off result

Reported by velina.i...@rooof.com, Aug 22

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3528.4 Safari/537.36

Steps to reproduce the problem:
1. Open chrome dev (v70) or canary
2. Run the attached snippet.

What is the expected behavior?
Expected output: 
["stringover13chars", index: 0, input: "stringover13chars", groups: undefined]

What went wrong?
Actual output: 
["stringove", index: 0, input: "stringover13chars", groups: undefined]

Did this work before? Yes 69.0.3497.42 (beta)

Chrome version: 70.0.3528.4  Channel: dev
OS Version: OS X 10.13.6
Flash Version: 

*Note: Inserting a delay before the last match() makes the problem go away.

**Note: Fail case is only observed on the first attempt - if you run the test function with the same string again, without reloading the page, it works as expected.

This issue was observed in a project using the following library: https://github.com/salsita/browser-require. The included snippet is the product of stripping that down to the minimal set of statements needed for reproduction.

Issue observed in OS X 10.13.6 and Windows 7.
 
repro.js
259 bytes View Download
Components: -Blink Blink>JavaScript
Labels: Needs-Bisect Needs-Triage-M70
Cc: rfbpb@google.com vamshi.kommuri@chromium.org
Components: -Blink>JavaScript Blink>JavaScript>GC
Labels: -Pri-2 -Needs-Bisect hasbisect-per-revision RegressedIn-70 Triaged-ET ReleaseBlock-Stable Target-70 M-70 FoundIn-70 OS-Linux OS-Windows Pri-1
Owner: verwa...@chromium.org
Status: Assigned (was: Unconfirmed)
Thanks for filing the issue!

Able to reproduce the issue on reported chrome version 70.0.3528.4 and on the latest 70.0.3530.0 using Windows 10, Ubuntu 17.10 and Mac 10.13.1.

Bisect Information:
--------------------
Good Build: 70.0.3502.0
Bad Build:  70.0.3503.0

You are probably looking for a change made after 578126 (known good), but no later than 578127 (first known bad).
CHANGELOG URL
https://chromium.googlesource.com/v8/v8/+log/4c27ac5c..ee658ba8
Suspecting: https://chromium.googlesource.com/v8/v8/+/da9386ae2d0416ac883cd1ce343a0ca3eac43519
Review URL: https://chromium-review.googlesource.com/1148281

@Toon Verwaest: Please help in assigning it to right owner if this is not related to your change.
Note: Couldn't assign to Rodrigo Bruno, hence assigning it to one of the reviewers. Adding RB-Stable as this seems to be a recent regression, please remove if not required.
Friendly ping to get an update on this issue as it is marked RBS.
Thanks..!
Any updates on this issue? We're getting worried, since it breaks business logic
Friendly ping! Could you please provide any update on this issue as it has been marked as a stable blocker.

Thank You!
Gentle ping! Could you please provide any update on this issue as it has been marked as a stable blocker.

Thank You!
Owner: u...@chromium.org
ulan, ptal
[bulk edit] - This issue is marked as a stable blocker for M70. We are two weeks away from M70 Stable. Please take a look urgently!
Cc: verwa...@chromium.org yangguo@chromium.org jkummerow@chromium.org
I think Rodrigo's CL is uncovering an existing bug.

The problem is one-byte/two-byte string confusion. In the posted repro case, we have two strings: url and urlPath.

Initial state:
url: two-byte-thin-string => two-byte-internalized-string
urlPath: two-byte-sliced-string => url

The XMLHttpRequest externalizes the url and turns the *two byte* internalizes string into a *one byte* external internalized string because it checks that all characters in the string are one byte [1].
So we have url: two-byte-thin-string => one-byte-external-internalized-string

The urlPath.match(/.*/) now thinks that the result is a two-byte string but uses the one byte backing store, so the result length is divided by 2.

[1]: https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/bindings/string_resource.cc?rcl=d41120d33ba8b51814a8305238bd903f42ee5b73&l=109


A quick fix would be to replace  v8_string->ContainsOnlyOneByte() with v8_string->IsOneByte().

But there seems to be a fundamental issue with one-byte/two-byte confusion for thin, cons, sliced strings. 

Yang and I found a bug in String::Is{One,Two}ByteRepresentationUnderneath that did not account for thin strings and did only one level of indirection.

The fix is in flight: https://chromium-review.googlesource.com/c/v8/v8/+/1256771
Project Member

Comment 12 by bugdroid1@chromium.org, Oct 2

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/530121037919721dd59577b9ddc848149def7eae

commit 530121037919721dd59577b9ddc848149def7eae
Author: Ulan Degenbaev <ulan@chromium.org>
Date: Tue Oct 02 14:46:04 2018

Fix String::Is{One,Two}ByteRepresentationUnderneath for thin strings.

Bug:  chromium:876759 
Change-Id: I9ea3c84b477e03f96cbef79a4a0b546a53a674ce
Reviewed-on: https://chromium-review.googlesource.com/1256771
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56339}
[modify] https://crrev.com/530121037919721dd59577b9ddc848149def7eae/src/objects/string-inl.h
[modify] https://crrev.com/530121037919721dd59577b9ddc848149def7eae/test/cctest/test-strings.cc

Labels: Merge-Request-70 OS-Android OS-Chrome
Project Member

Comment 14 by sheriffbot@chromium.org, Oct 2

Labels: -Merge-Request-70 Merge-Review-70 Hotlist-Merge-Review
This bug requires manual review: We are only 13 days from stable.
Please contact the milestone owner if you have questions.
Owners: benmason@(Android), kariahda@(iOS), geohsu@(ChromeOS), abdulsyed@(Desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
NextAction: 2018-10-03
Let's wait on canary data...
The NextAction date has arrived: 2018-10-03
How does it look in canary?
Labels: -Merge-Review-70 Merge-Approved-70
Project Member

Comment 20 by bugdroid1@chromium.org, Oct 8

Labels: merge-merged-7.0
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/b6b1d5874d480be6b2969c65dfc947c41ee8bdac

commit b6b1d5874d480be6b2969c65dfc947c41ee8bdac
Author: Ulan Degenbaev <ulan@chromium.org>
Date: Mon Oct 08 13:46:01 2018

Merged: Fix String::Is{One,Two}ByteRepresentationUnderneath for thin strings.

Revision: 530121037919721dd59577b9ddc848149def7eae

BUG= chromium:876759 
LOG=N
NOTRY=true
NOPRESUBMIT=true
NOTREECHECKS=true
R=mlippautz@chromium.org

Change-Id: I45ecb6d7343e708f0e80c385546768a11be24170
Reviewed-on: https://chromium-review.googlesource.com/c/1268019
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/branch-heads/7.0@{#53}
Cr-Branched-From: 6e2adae6f7f8e891cfd01f3280482b20590427a6-refs/heads/7.0.276@{#1}
Cr-Branched-From: bc08a8624cbbea7a2d30071472bc73ad9544eadf-refs/heads/master@{#55424}
[modify] https://crrev.com/b6b1d5874d480be6b2969c65dfc947c41ee8bdac/src/objects/string-inl.h
[modify] https://crrev.com/b6b1d5874d480be6b2969c65dfc947c41ee8bdac/test/cctest/test-strings.cc

Status: Fixed (was: Assigned)
Closing this out now as it's merged to 70.
Project Member

Comment 22 by sheriffbot@chromium.org, Oct 9

Cc: abdulsyed@google.com
This issue has been approved for a merge. Please merge the fix to any appropriate branches as soon as possible!

If all merges have been completed, please remove any remaining Merge-Approved labels from this issue.

Thanks for your time! To disable nags, add the Disable-Nags label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: -Merge-Approved-70

Sign in to add a comment