New issue
Advanced search Search tips

Issue 900747 link

Starred by 1 user

Issue metadata

Status: Duplicate
Merged: issue 699319
Owner: ----
Closed: Nov 15
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Mojo should check that "string" type data is valid UTF-8

Project Member Reported by c...@chromium.org, Oct 31

Issue description

While working through a change that adds a Blink-variant of a Mojom definition, I hit a case where the browser and renderer processes were sending data via a string type that contained invalid UTF-8.  Previously, both sides of the pipe were in the Content layer and both used std::string, so sending data this way, while bad practice, was technically possible and worked fine.

The new Blink-variant I added auto-maps that string type to WTF::String via Mojo's C++ traits.  string_traits_wtf.* uses String::FromUTF8() which invalidates string data that contains invalid UTF-8.  As a result, the Blink-variant string was getting set to the null string and later codepaths that assumed correct data was received failed.  We plan to fix the design issue in our Mojom definition by changing that type from string to array<uint8>.

As an idea for improvement, if Mojo alerted when string types contain invalid UTF-8, the early notification would have helped us find and fix a design issue before the potential for data loss.  Filing here after discussing with Ken.
 
Mergedinto: 699319
Status: Duplicate (was: Untriaged)
Found the old bug that was supposed to be tracking this.

Sign in to add a comment