Skip to content

Fix out-of-bounds read in UTF-8/UTF-16 decoders - #218

Merged
khaledhosny merged 1 commit into
mainfrom
fix-utf-oob-read
Jul 17, 2026
Merged

khaledhosny merged 1 commit into
mainfrom
fix-utf-oob-read

Conversation

@khaledhosny

Copy link
Copy Markdown
Collaborator

The decoders read continuation bytes past the buffer end for a truncated multi-byte sequence at the tail, and the conversion loops over-read by one on non-NUL-terminated input.

Replace both with ports of HarfBuzz's hb_utf8_t::next() and hb_utf16_xe_t::next(), which are bounds-safe and substitute U+FFFD for ill-formed input.

The decoders read continuation bytes past the buffer end for a truncated
multi-byte sequence at the tail, and the conversion loops over-read by
one on non-NUL-terminated input.

Replace both with ports of HarfBuzz's hb_utf8_t::next() and
hb_utf16_xe_t::next(), which are bounds-safe and substitute U+FFFD for
ill-formed input.
@khaledhosny
khaledhosny merged commit 91f91a8 into main Jul 17, 2026
8 checks passed
@khaledhosny
khaledhosny deleted the fix-utf-oob-read branch July 17, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant