From d2627dfad874160275c6ed3f4625f8bd81121bf2 Mon Sep 17 00:00:00 2001 From: artemp Date: Mon, 12 Jun 2017 17:52:02 +0200 Subject: [PATCH] tiff_reader - fix `num_rows` logic in `read_stripped` method ref #3679 --- src/tiff_reader.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/tiff_reader.cpp b/src/tiff_reader.cpp index 81ac112f7..4f24dafc2 100644 --- a/src/tiff_reader.cpp +++ b/src/tiff_reader.cpp @@ -732,7 +732,6 @@ void tiff_reader::read_stripped(std::size_t x0, std::size_t y0, ImageData & i std::size_t start_y = (y0 / rows_per_strip_) * rows_per_strip_; std::size_t end_y = std::min(y0 + height, height_); std::size_t tx0, tx1, ty0, ty1; - tx0 = x0; tx1 = std::min(width + x0, width_); std::size_t row = 0; @@ -758,7 +757,7 @@ void tiff_reader::read_stripped(std::size_t x0, std::size_t y0, ImageData & i if (detail::tiff_reader_traits::reverse) { - std::size_t num_rows = std::min(end_y - y, static_cast(rows_per_strip_)); + std::size_t num_rows = std::min(height_ - y, static_cast(rows_per_strip_)); for (std::size_t ty = ty0; ty < ty1; ++ty) { // This is in reverse because the TIFFReadRGBAStrip reads are inverted