]> git.saurik.com Git - wxWidgets.git/blobdiff - src/tiff/tif_thunder.c
various close-button styles implemented in wxAuiNotebook
[wxWidgets.git] / src / tiff / tif_thunder.c
index e77e7be71fd8190a323bddaa4971fa4f5ba25746..08807959805872c3b5ee16b1115125de77c405d6 100644 (file)
@@ -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;