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

Address Rust String Null Byte Handling #13

Open
arriqaaq opened this issue Jan 11, 2024 · 0 comments
Open

Address Rust String Null Byte Handling #13

arriqaaq opened this issue Jan 11, 2024 · 0 comments

Comments

@arriqaaq
Copy link
Contributor

          Just a note that rust strings can freely contain null bytes. `"foo\0bar"` is allowed in rust and will have a lenght of 7. So in rust adding a null byte you might still end up with a prefixed string.

Maybe instead of a null byte you could add something like 0b10111111? All rust strings are valid UTF-8 and a UTF-8 character can never begin with a 10 bit pattern as this the start pattern of a continuation byte. So for rust strings this would ensure that no byte slice derived from a string is a prefix of another.

Originally posted by @DelSkayn in surrealdb/surrealkv#5 (comment)

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

No branches or pull requests

1 participant