New issue
Advanced search Search tips

Issue 873280 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

[SessionStorage] Invalid UTF16 key handling causes entries to change after loading from disk.

Project Member Reported by dmu...@chromium.org, Aug 10

Issue description

Session storage keys are always converted to UTF8 before saving to disk. When there is an invalid utf16 string (with unpaired surrogates), this is replaced with 0xfffd.

However, the in-memory session storage cache keeps the original utf16 data as a key. So data will seem correct here.

However, if session storage is reloaded from disk, then the key loaded into memory will be the one with 0xfffd's, and it will no longer work.


Todo - add metrics to track how many keys have FFFD surrogates.
Possibly fix by causing session storage to throw an exception on invalid utf16 keys.
 
Summary: [SessionStorage] Invalid UTF16 key handling causes entries to change after loading from disk. (was: [SessionStorage] Invalid UTF16 key handling causes possible collisions after loading from disk.)
Rather than throwing, we could change the key from DOMString to USVString which will do the surrogate replacement. But that's a web API change.

There should be a code path somewhere for 'WTF-8' conversion which is UTF-8 but handles unpaired surrogates. 
(note that it won't be called WTF-8. That's a totally unofficial name invented at https://simonsapin.github.io/wtf-8/ to describe this stuff)
... and it doesn't look like this is exposed in base/strings/ which is where I think we got stuck on similar issues in the past.
Components: Blink>TextEncoding
Status: Available (was: Untriaged)
Solving this will let us change the session storage backend more easily to be UTF8. Marking as available P3.

Sign in to add a comment