Skip to content
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

Add tests for invalid UTF-8 sequences in v8::String::new_from_utf8 #1190

Merged
merged 1 commit into from
Mar 16, 2023

Conversation

aapoalas
Copy link
Contributor

@aapoalas aapoalas commented Feb 11, 2023

Preparing to remove my added check for UTF-8 correctness in Deno FFI's getCString binding.

It seems that the new_from_utf8 API is indeed resilient against invalid UTF-8 sequences. The lengths asserted in these tests correspond to the expectations that I get from doing new TextDecoder().decode(Uint8Array.from([...])).length in Chrome DevTools and in Deno CLI REPL.

Test sequences are copied over from Stack Overflow: https://stackoverflow.com/a/3886015

Copy link
Member

@littledivy littledivy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ry ry merged commit 57c5d93 into denoland:main Mar 16, 2023
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.

3 participants