Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Crash when parsing invalid/malformed UTF16 #56

Closed
alexdima opened this issue Aug 26, 2016 · 0 comments
Closed

Crash when parsing invalid/malformed UTF16 #56

alexdima opened this issue Aug 26, 2016 · 0 comments
Labels

Comments

@alexdima
Copy link
Contributor

From microsoft/vscode#10945

The UTF16<->UTF8 offset map computation in OnigString skips unmatched high surrogates, while v8's UTF16->UTF8 converter interprets them as "literal" code points.

This can lead to a situation where utf8OffsetToUtf16 is not completely initialized (as the unmatched high surrogates are skipped).

Moreover, the ConvertUtf8OffsetToUtf16 and ConvertUtf16OffsetToUtf8 are lacking index bounds checks.

I have a PR ready to fix these issues, sorry about introducing them in the first place.

@50Wliu 50Wliu added the bug label Aug 26, 2016
maxbrunsfeld pushed a commit that referenced this issue Sep 20, 2016
Fixes #56: Do not ignore unmatched high surrogates, check index is within bounds
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants