Fix capacity overflow in JpegReader

This commit is contained in:
fedotoff committed 2023-02-05 17:53:37 +03:00
1 parent 4dea7c4c81
commit 8fa175c371
2 files changed
+6

No files matched your search

+4
View File
@@ -458,6 +458,7 @@ impl Image {
output_width: usize,
byte_order: ByteOrder,
chunk_index: u32,
limits: &Limits,
) -> TiffResult<()> {
// Validate that the provided buffer is of the expected type.
let color_type = self.colortype()?;
@@ -511,6 +512,9 @@ impl Image {
.ok_or(TiffError::FormatError(
TiffFormatError::InconsistentSizesEncountered,
))?;
if *compressed_bytes > limits.intermediate_buffer_size as u64 {
return Err(TiffError::LimitsExceeded);
}
let byte_len = buffer.byte_len();
let compression_method = self.compression_method;