Skip to content

unix,win: fix off-by-one in uv_wtf8_to_utf16()#4609

Merged
bnoordhuis merged 1 commit intolibuv:v1.xfrom
bnoordhuis:fix55914
Nov 19, 2024
Merged

unix,win: fix off-by-one in uv_wtf8_to_utf16()#4609
bnoordhuis merged 1 commit intolibuv:v1.xfrom
bnoordhuis:fix55914

Conversation

@bnoordhuis
Copy link
Copy Markdown
Member

uv_wtf8_length_as_utf16() checks if codepoints are > 0xFFFF (to see if it should be encoded as a surrogate pair), therefore uv_wtf8_to_utf16() should too. Instead it checked > 0x1000. Harmonize the checks.

Fixes: nodejs/node#55914


The wtf8 code seems to have no tests at all? Did I overlook them?

uv_wtf8_length_as_utf16() checks if codepoints are > 0xFFFF (to see if
it should be encoded as a surrogate pair), therefore uv_wtf8_to_utf16()
should too. Instead it checked > 0x1000. Harmonize the checks.

Fixes: nodejs/node#55914
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.

fs.stat crash program on invalid string

4 participants