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.
This commit is contained in:
1 parent
6e23274bea
commit
a439baa948
1 file changed
+1
-1
+1
-1
@@ -744,7 +744,7 @@ impl<R: Read + Seek> Decoder<R> {
|
|||||||
|
|
||||||
let buffer_size = usize::try_from(self.width)? * strip_height * self.bits_per_sample.len();
|
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(
|
return Err(TiffError::FormatError(
|
||||||
TiffFormatError::InconsistentSizesEncountered,
|
TiffFormatError::InconsistentSizesEncountered,
|
||||||
));
|
));
|
||||||
|
|||||||
Reference in new issue
Block a user