diff options
-rw-r--r-- | tiff/libtiff/tif_thunder.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tiff/libtiff/tif_thunder.c b/tiff/libtiff/tif_thunder.c index db6383a81..b56e3c359 100644 --- a/tiff/libtiff/tif_thunder.c +++ b/tiff/libtiff/tif_thunder.c @@ -112,10 +112,10 @@ ThunderDecode(TIFF* tif, uint8* op, tmsize_t maxpixels) } else lastpixel |= lastpixel << 4; npixels += n; - if (npixels < maxpixels) { - for (; n > 0; n -= 2) - *op++ = (uint8) lastpixel; - } + if (npixels > maxpixels) + n -= npixels - maxpixels; + for (; n > 0; n -= 2) + *op++ = (uint8) lastpixel; if (n == -1) *--op &= 0xf0; lastpixel &= 0xf; |