Skip to content

fix OOB on String.UTF8.encode using nullTerminated = true #2173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 13, 2021

Conversation

romdotdog
Copy link
Contributor

@romdotdog romdotdog commented Dec 11, 2021

fixes #2021

Examples

before it worked like this

String.UTF8.byteLength("a\0", true); // -> 2
String.UTF8.encode("a\0", true); // writes 0x61, 0x00, and then another 0x00

now it works like this

String.UTF8.byteLength("a\0", true); // -> 2
String.UTF8.encode("a\0", true); // writes 0x61, 0x00 and breaks because of the null
  • I've read the contributing guidelines
  • I've added my name and email to the NOTICE file

@romdotdog romdotdog requested a review from dcodeIO December 12, 2021 18:24
@dcodeIO dcodeIO merged commit 09beb42 into AssemblyScript:main Dec 13, 2021
@dcodeIO
Copy link
Member

dcodeIO commented Dec 13, 2021

Thanks :)

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.

Maybe there is a bug for String.UTF8.encode and String.UTF8.decode
2 participants