Description
Before 1.0.0, itoa
used std::mem::uninitialized
to use uninitialized u8
s. This is now regarded as being undefined behaviour, and itoa
correctly switched to MaybeUninit
instead some time ago. But this switch came with a new major version, meaning crates that still depend on old itoa (like the current published version of csv
) do not get that soundness fix.
See: rust-lang/rust#66151 for more info around mem::uninitialized
.
Therefore, I would suggest backporting a soundness fix for 0.4.x. We can't use MaybeUninit
, since that would increase the MSRV which is probably not desired. I would suggest to zero-initialize it instead. While this can come at a minor perf impact, it's for an old and outdated version, and most people will likely have upgrade their dependencies already. This would also be a really simple change.
What's your opinion on this? Is this something we should do right now? Maybe at a later point in the future?