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

Issue 761466 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Sep 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 3
Type: Bug



Sign in to add a comment

Invalid pattern exception shows garbled characters instead of non-ASCII UTF-8 characters

Project Member Reported by phistuck@gmail.com, Sep 1 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36

Steps to reproduce the problem:
1. Go to -
data:text/html;charset=utf-8,<!doctype html><form><input required pattern="+[%D7%90-%D7%AA]"><input type=submit>
2. Open the Developer Tools.
3. Enter a non Hebrew letter.
4. Submit the form.
5. Look at the console.

What is the expected behavior?
Pattern attribute value +[א-ת] is not a valid regular expression: Uncaught SyntaxError: Invalid regular expression: /+[א-ת]/: Nothing to repeat

What went wrong?
Pattern attribute value +[א-ת] is not a valid regular expression: Uncaught SyntaxError: Invalid regular expression: /+[א-ת]/: Nothing to repeat

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 60.0.3112.113  Channel: stable
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version:
 

Comment 1 by phistuck@gmail.com, Sep 1 2017

Do the same with -
data:text/html;charset=utf-8,<!doctype html><form><input required pattern="+%00"><input type=submit>
And it will output a sequence of characters (probably UTF-8 BOM) instead of the null character (%00, \0 or even nothing) -
Pattern attribute value +� is not a valid regular expression: Uncaught SyntaxError: Invalid regular expression: /+�/: Nothing to repeat
Components: -Blink>Forms Blink>Forms>Validation Platform>DevTools
Status: Untriaged (was: Unconfirmed)
Probably unrelated to the Developer Tools, but maybe.

The message that the Developer Tools backend sends -

VM443:1 {"method":"Log.entryAdded","params":{"entry":{"source":"rendering","level":"error","text":"Pattern attribute value +\u00EF\u00BF\u00BD is not a valid regular expression: Uncaught SyntaxError: Invalid regular expression: /+\u00EF\u00BF\u00BD/: Nothing to repeat","timestamp":1504291126687.89,"url":"data:text/html;charset=utf-8,\u003C!doctype html\u003E\u003Cform\u003E\u003Cinput required pattern=\"+%00\"\u003E\u003Cinput type=submit\u003E"}}}

So it is surely not a front-end problem.
Owner: tkent@chromium.org
Status: Assigned (was: Untriaged)
It is utf, but strings in Blink are utf16, so String::Format is misused.

Comment 5 by tkent@chromium.org, Sep 4 2017

Components: -Platform>DevTools Blink>Forms>Text
Labels: -Pri-2 Hotlist-GoodFirstBug Pri-3
Owner: ----
Status: Available (was: Assigned)
I found String::format() supported only LChar. We can't use non-Latin1 characters at all.

Owner: shanmug...@samsung.com
Status: Assigned (was: Available)
Status: Started (was: Assigned)
Project Member

Comment 8 by bugdroid1@chromium.org, Sep 20 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/16998683979b56208252c259ea550ad4c82af935

commit 16998683979b56208252c259ea550ad4c82af935
Author: Shanmuga Pandi M <shanmuga.m@samsung.com>
Date: Wed Sep 20 06:47:38 2017

Avoid the usage of String::Format for non-ASCII UTF-8 characters.

String::Format is supported only LChar. So we cant use
non-Latin1 characters at all and usage of this showing garbled
characters instead of non-ASCII UTF-8 characters.

Bug:  761466 
Change-Id: Ie113b537227b79a59c3a9b96e85d1aaad62d5d29
Reviewed-on: https://chromium-review.googlesource.com/672243
Reviewed-by: Kent Tamura <tkent@chromium.org>
Commit-Queue: Shanmuga Pandi <shanmuga.m@samsung.com>
Cr-Commit-Position: refs/heads/master@{#503074}
[modify] https://crrev.com/16998683979b56208252c259ea550ad4c82af935/third_party/WebKit/Source/core/html/forms/BaseTextInputType.cpp
[modify] https://crrev.com/16998683979b56208252c259ea550ad4c82af935/third_party/WebKit/Source/platform/wtf/text/WTFString.h

Status: Fixed (was: Started)

Comment 10 by tkent@chromium.org, Sep 20 2017

Labels: M-63

Sign in to add a comment