Closed aapoalas closed 1 month ago
The method https://github.com/denoland/rusty_v8/blob/main/src/string.rs#L153-L168 converts to a Rust &str without checking the validity of the data because "The data is guaranteed to be ASCII."
&str
But both https://github.com/denoland/rusty_v8/blob/main/src/string.rs#L582-L596 and https://github.com/denoland/rusty_v8/blob/main/src/string.rs#L627-L643 are documented as accepting Latin-1 characters.
A UTF-8 string borrowed from a ExternalOneByteStringResource may thus not actually be valid UTF-8.
ExternalOneByteStringResource
The method https://github.com/denoland/rusty_v8/blob/main/src/string.rs#L153-L168 converts to a Rust
&str
without checking the validity of the data because "The data is guaranteed to be ASCII."But both https://github.com/denoland/rusty_v8/blob/main/src/string.rs#L582-L596 and https://github.com/denoland/rusty_v8/blob/main/src/string.rs#L627-L643 are documented as accepting Latin-1 characters.
A UTF-8 string borrowed from a
ExternalOneByteStringResource
may thus not actually be valid UTF-8.