Merge pull request #200 from anfedotoff/master

Fix capacity overflow in JpegReader
This commit is contained in:
Andreas Molzer authored and GitHub committed 2023-02-06 21:22:13 +01:00
commit aa10d27a28
2 files changed
+6

No files matched your search

+4
View File
@@ -466,6 +466,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()?;
@@ -520,6 +521,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;