]> git.saurik.com Git - wxWidgets.git/blobdiff - src/tiff/tif_next.c
Rename boolean to wxjpeg_boolean to avoid conflicts.
[wxWidgets.git] / src / tiff / tif_next.c
index 74593a6b5fd4b7fa1be6bb6670564a5d9d3d53e5..42d631e07fdade4c379cb4ff909bd4600c8be675 100644 (file)
@@ -34,7 +34,7 @@
 
 #define SETPIXEL(op, v) {                      \
        switch (npixels++ & 3) {                \
-       case 0: op[0]  = (v) << 6; break;       \
+       case 0: op[0]  = (u_char) ((v) << 6); break;    \
        case 1: op[0] |= (v) << 4; break;       \
        case 2: op[0] |= (v) << 2; break;       \
        case 3: *op++ |= (v);      break;       \
@@ -87,7 +87,7 @@ NeXTDecode(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
                         */
                        off = (bp[0] * 256) + bp[1];
                        n = (bp[2] * 256) + bp[3];
-                       if (cc < 4+n)
+                       if (cc < 4+n || off+n > scanline)
                                goto bad;
                        _TIFFmemcpy(row+off, bp+4, n);
                        bp += 4+n;
@@ -111,7 +111,7 @@ NeXTDecode(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
                                n &= 0x3f;
                                while (n-- > 0)
                                        SETPIXEL(op, grey);
-                               if (npixels >= imagewidth)
+                               if (npixels >= (int) imagewidth)
                                        break;
                                if (cc == 0)
                                        goto bad;