From a439baa948ddee41997bf562c27421de28362360 Mon Sep 17 00:00:00 2001 From: Andrew Champion Date: Sun, 9 Feb 2020 18:22:07 +0000 Subject: [PATCH] Decoder: remove test make wrong assumption The byte count for strips is the compressed length. The compressed length may be larger than the uncompressed length, especially with poor compression choices (multi-byte samples with packbits) or small images. --- src/decoder/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/decoder/mod.rs b/src/decoder/mod.rs index 007e403..a2cd6a0 100644 --- a/src/decoder/mod.rs +++ b/src/decoder/mod.rs @@ -744,7 +744,7 @@ impl Decoder { let buffer_size = usize::try_from(self.width)? * strip_height * self.bits_per_sample.len(); - if buffer.len() < buffer_size || usize::try_from(byte_count)? / buffer.byte_len() > buffer_size { + if buffer.len() < buffer_size { return Err(TiffError::FormatError( TiffFormatError::InconsistentSizesEncountered, ));