|
ret.set_len(pixel_count); |
Vec::set_len leads to the creation of uninitialized memory which can be dropped if an error occurs during decoding. Additionally the other functions like decode_component have to be very careful to overwrite every single byte in the buffer lest uninitialized memory leak to the outside.
Is there any reason why vec![0; n] can't be used here? I doubt there would be a significant performance impact, if at all.
image/src/hdr/decoder.rs
Line 346 in 984e092
Vec::set_lenleads to the creation of uninitialized memory which can be dropped if an error occurs during decoding. Additionally the other functions likedecode_componenthave to be very careful to overwrite every single byte in the buffer lest uninitialized memory leak to the outside.Is there any reason why
vec![0; n]can't be used here? I doubt there would be a significant performance impact, if at all.