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?
Since calling
Stringon aviewof anAbstractVector{UInt8}is potential UB #54372 (comment)I think it would be helpful to have a function.
I could use this to fix
ZipArchives.jlby replacing current uses of theStringconstructor on vectors of bytes withcopystring.Would this be better in a separate
CopyStrings.jlpackage?