From 60f5a8f4503c8958d27949b18d4fb522aef9da3d Mon Sep 17 00:00:00 2001 From: Jonathan Behrens Date: Sun, 23 Sep 2018 01:12:39 -0400 Subject: [PATCH] Fix calculation of uncompressed_strip_size --- 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 fed59f6..006e24c 100644 --- a/src/decoder/mod.rs +++ b/src/decoder/mod.rs @@ -472,7 +472,7 @@ impl Decoder { for (i, (&offset, &byte_count)) in try!(self.get_tag_u32_vec(ifd::Tag::StripOffsets)) .iter().zip(try!(self.get_tag_u32_vec(ifd::Tag::StripByteCounts)).iter()).enumerate() { let uncompressed_strip_size = scanline_size - * (self.height as usize - i * rows_per_strip); + * (self.height as usize - i * rows_per_strip).min(rows_per_strip); units_read += match result { DecodingResult::U8(ref mut buffer) => {