-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
With the memory changes the UB surface of String(Vector{UInt8}) is larger #54434
Comments
I think it's pretty hard to accidentally cause UB with the current implementation, because as far as I can tell
Edit: I see that |
Observing/modifying the data of a Vector{UInt8} after one has called
String(vec)
on it has always been UB, this was usually fine because it's quite hard on a pre-Memory{T} world to have two arrays alias eachother while not being===
, this is no longer true with Memory, where one can still keep that Memory around and have it be shared by the string, which can make it possible to mutate it, causing UB.One option woul to have
String(vec)
now make a copy and create something likeunsafe_take!
or similar like suggested in #54424 which makes it clear that this is a potentially unsafe function.The text was updated successfully, but these errors were encountered: