-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Closed
Labels
Description
Since calling String
on a view
of an AbstractVector{UInt8}
is potential UB #54372 (comment)
I think it would be helpful to have a function.
copystring(v::AbstractVector{UInt8}) = take_string!(copyto!(StringMemory(length(v)), v)))
I could use this to fix ZipArchives.jl
by replacing current uses of the String
constructor on vectors of bytes with copystring
.
Would this be better in a separate CopyStrings.jl
package?