diff --git a/src/hdr/hdr_decoder.rs b/src/hdr/hdr_decoder.rs index 94723a3e0c..01dea6e285 100644 --- a/src/hdr/hdr_decoder.rs +++ b/src/hdr/hdr_decoder.rs @@ -51,6 +51,10 @@ impl HDRAdapter { let mut img: Vec> = decoder.read_image_ldr()?; // let's transform Vec> into Vec let p = img.as_mut_ptr() as *mut u8; + // NOTE: These multiplications cannot overflow because, + // if they did, that would imply that the original + // vector's length (in bytes) was larger than the max + // usize value. let len = img.len() * elem_len; // length in bytes let cap = img.capacity() * elem_len; // ::std::mem::forget(img);