surrealdb/vart

Address Rust String Null Byte Handling

arriqaaq opened this issue · 1 comments

          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)