| Summary: | UTF-8 handling in MediaFragmentURIParser::parseFragments() seems wrong | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Chris Dumez <cdumez> |
| Component: | Media | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW --- | ||
| Severity: | Normal | CC: | ahmad.saleem792, annevk, darin, eric.carlson, jer.noble, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| URL: | https://www.w3.org/2008/WebVideo/Fragments/WD-media-fragments-spec/#processing-name-value-components | ||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=238408 | ||
imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/media_fragment_seek.html seems to be this only WPT test we have that exercises this logic, but doesn't actually seem to cover UTF-8 cases. (In reply to Chris Dumez from comment #1) > imported/w3c/web-platform-tests/html/semantics/embedded-content/media- > elements/media_fragment_seek.html seems to be this only WPT test we have > that exercises this logic, but doesn't actually seem to cover UTF-8 cases. Looks like there are quite a few related tests in media/media-fragments though. |
UTF-8 handling in MediaFragmentURIParser::parseFragments() seems wrong: ``` // b. Convert name and value to Unicode strings by interpreting them as UTF-8. If either // name or value are not valid UTF-8 strings, then remove the name-value pair from the list. bool validUTF8 = false; if (!name.isEmpty() && !value.isEmpty()) { name = String { name.utf8(StrictConversion).data() }; validUTF8 = !name.isEmpty(); if (validUTF8) { value = String { value.utf8(StrictConversion).data() }; validUTF8 = !value.isEmpty(); } } ``` Note that `String { }` parses the input string as latin1, not UTF-8. So we're converting to UTF-8 and then back as latin1.