1diff --git a/third_party/libtiff/tif_getimage.c b/third_party/libtiff/tif_getimage.c
2index 03c9a81fb..d37f729c4 100644
3--- a/third_party/libtiff/tif_getimage.c
4+++ b/third_party/libtiff/tif_getimage.c
5@@ -681,7 +681,7 @@ gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
6        return (0);
7     }
8     leftmost_toskew = safeskew;
9-    for (row = 0; row < h; row += nrow)
10+    for (row = 0; ret != 0 && row < h; row += nrow)
11     {
12         rowstoread = th - (row + img->row_offset) % th;
13        nrow = (row + rowstoread > h ? h - row : rowstoread);
14@@ -830,7 +830,7 @@ gtTileSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
15        leftmost_fromskew = img->col_offset % tw;
16        leftmost_tw = tw - leftmost_fromskew;
17        leftmost_toskew = toskew + leftmost_fromskew;
18-       for (row = 0; row < h; row += nrow)
19+       for (row = 0; ret != 0 && row < h; row += nrow)
20        {
21                rowstoread = th - (row + img->row_offset) % th;
22                nrow = (row + rowstoread > h ? h - row : rowstoread);
23