diff --git a/libtiff/tif_lzw.c b/libtiff/tif_lzw.c index 63d307ce..c335fd36 100644 --- a/libtiff/tif_lzw.c +++ b/libtiff/tif_lzw.c @@ -1,4 +1,4 @@ -/* $Id: tif_lzw.c,v 1.32 2007-04-10 02:41:15 joris Exp $ */ +/* $Id: tif_lzw.c,v 1.33 2007-04-10 02:56:33 joris Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -27,7 +27,7 @@ #include "tiffiop.h" #ifdef LZW_SUPPORT /* - * TIFF Library. + * TIFF Library. * Rev 5.0 Lempel-Ziv & Welch Compression Support * * This code is derived from the compress program whose code is diff --git a/libtiff/tif_next.c b/libtiff/tif_next.c index f2e98e88..81642a45 100644 --- a/libtiff/tif_next.c +++ b/libtiff/tif_next.c @@ -1,4 +1,4 @@ -/* $Id: tif_next.c,v 1.10 2007-03-31 01:41:11 joris Exp $ */ +/* $Id: tif_next.c,v 1.11 2007-04-10 02:56:33 joris Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -46,12 +46,13 @@ #define WHITE ((1<<2)-1) static int -NeXTDecode(TIFF* tif, tidata_t buf, tsize_t occ, uint16 s) +NeXTDecode(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s) { + static const char module[] = "NeXTDecode"; unsigned char *bp, *op; - tsize_t cc; - tidata_t row; - tsize_t scanline, n; + tmsize_t cc; + uint8* row; + tmsize_t scanline, n; (void) s; /* @@ -59,12 +60,17 @@ NeXTDecode(TIFF* tif, tidata_t buf, tsize_t occ, uint16 s) * white (we assume a PhotometricInterpretation * of ``min-is-black''). */ - for (op = buf, cc = occ; cc-- > 0;) + for (op = (unsigned char*) buf, cc = occ; cc-- > 0;) *op++ = 0xff; bp = (unsigned char *)tif->tif_rawcp; - cc = tif->tif_rawcc; ddd - scanline = tif->tif_scanlinesize; ddd + cc = tif->tif_rawcc; + scanline = tif->tif_scanlinesize; + if (occ % scanline) + { + TIFFErrorExt(tif->tif_clientdata, module, "Fractional scanlines cannot be read"); + return (0); + } for (row = buf; occ > 0; occ -= scanline, row += scanline) { n = *bp++, cc--; switch (n) { @@ -79,7 +85,7 @@ NeXTDecode(TIFF* tif, tidata_t buf, tsize_t occ, uint16 s) cc -= scanline; break; case LITERALSPAN: { - tsize_t off; + tmsize_t off; /* * The scanline has a literal span that begins at some * offset. @@ -124,11 +130,11 @@ NeXTDecode(TIFF* tif, tidata_t buf, tsize_t occ, uint16 s) } } } - tif->tif_rawcp = (tidata_t) bp; - tif->tif_rawcc = cc; ddd + tif->tif_rawcp = (uint8*) bp; + tif->tif_rawcc = cc; return (1); bad: - TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "NeXTDecode: Not enough data for scanline %ld", + TIFFErrorExt(tif->tif_clientdata, module, "Not enough data for scanline %ld", (long) tif->tif_row); return (0); } @@ -137,9 +143,9 @@ int TIFFInitNeXT(TIFF* tif, int scheme) { (void) scheme; - tif->tif_decoderow = NeXTDecode; ddd - tif->tif_decodestrip = NeXTDecode; ddd - tif->tif_decodetile = NeXTDecode; ddd + tif->tif_decoderow = NeXTDecode; + tif->tif_decodestrip = NeXTDecode; + tif->tif_decodetile = NeXTDecode; return (1); } #endif /* NEXT_SUPPORT */ diff --git a/libtiff/tif_print.c b/libtiff/tif_print.c index 960e468a..644d0af7 100644 --- a/libtiff/tif_print.c +++ b/libtiff/tif_print.c @@ -1,4 +1,4 @@ -/* $Id: tif_print.c,v 1.39 2007-04-04 04:16:07 joris Exp $ */ +/* $Id: tif_print.c,v 1.40 2007-04-10 02:56:33 joris Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -598,7 +598,7 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags) uint32 s; fprintf(fd, " %lu %s:\n", - (long) td->td_nstrips, ddd + (long) td->td_nstrips, isTiled(tif) ? "Tiles" : "Strips"); for (s = 0; s < td->td_nstrips; s++) fprintf(fd, " %3lu: [%8llu, %8llu]\n",