Fix OOM in Jpeg decoding buffer allocation

This commit is contained in:
5225225 committed 2021-05-29 22:12:35 +01:00
1 parent 458a713827
commit a15d619471
2 files changed
+27

No files matched your search

+8
View File
@@ -1382,6 +1382,14 @@ impl<R: Read + Seek> Decoder<R> {
));
}
if offsets[0] as usize > self.limits.intermediate_buffer_size
|| bytes
.iter()
.any(|&x| x as usize > self.limits.intermediate_buffer_size)
{
return Err(TiffError::LimitsExceeded);
}
let mut res_img = Vec::with_capacity(offsets[0] as usize);
for (idx, offset) in offsets.iter().enumerate() {