X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b47c832e5529dc6c632536b4665a005f0a85aec8..0e2a14e5e30994698f213daf2fc9e3d897846f4d:/src/tiff/tif_thunder.c?ds=sidebyside diff --git a/src/tiff/tif_thunder.c b/src/tiff/tif_thunder.c index e77e7be71f..0880795980 100644 --- a/src/tiff/tif_thunder.c +++ b/src/tiff/tif_thunder.c @@ -60,7 +60,7 @@ static const int threebitdeltas[8] = { 0, 1, 2, 3, 0, -3, -2, -1 }; if (npixels++ & 1) \ *op++ |= lastpixel; \ else \ - op[0] = lastpixel << 4; \ + op[0] = (tidataval_t) (lastpixel << 4); \ } static int @@ -91,8 +91,10 @@ ThunderDecode(TIFF* tif, tidata_t op, tsize_t maxpixels) } else lastpixel |= lastpixel << 4; npixels += n; - for (; n > 0; n -= 2) - *op++ = lastpixel; + if (npixels < maxpixels) { + for (; n > 0; n -= 2) + *op++ = (tidataval_t) lastpixel; + } if (n == -1) *--op &= 0xf0; lastpixel &= 0xf;