| Index: third_party/libtiff/tif_next.c
|
| diff --git a/third_party/tiff_v403/tif_next.c b/third_party/libtiff/tif_next.c
|
| similarity index 86%
|
| rename from third_party/tiff_v403/tif_next.c
|
| rename to third_party/libtiff/tif_next.c
|
| index 9f2f6d5307923dbcce4c11085fbddf945394fe32..17e031111a195a56c70e1e02df6d5a4439676e88 100644
|
| --- a/third_party/tiff_v403/tif_next.c
|
| +++ b/third_party/libtiff/tif_next.c
|
| @@ -1,4 +1,4 @@
|
| -/* $Id: tif_next.c,v 1.13 2010-03-10 18:56:48 bfriesen Exp $ */
|
| +/* $Id: tif_next.c,v 1.16 2014-12-29 12:09:11 erouault Exp $ */
|
|
|
| /*
|
| * Copyright (c) 1988-1997 Sam Leffler
|
| @@ -23,6 +23,7 @@
|
| * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| * OF THIS SOFTWARE.
|
| */
|
| +
|
| #include "tiffiop.h"
|
| #ifdef NEXT_SUPPORT
|
| /*
|
| @@ -70,7 +71,7 @@ NeXTDecode(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)
|
| TIFFErrorExt(tif->tif_clientdata, module, "Fractional scanlines cannot be read");
|
| return (0);
|
| }
|
| - for (row = buf; occ > 0; occ -= scanline, row += scanline) {
|
| + for (row = buf; cc > 0 && occ > 0; occ -= scanline, row += scanline) {
|
| n = *bp++, cc--;
|
| switch (n) {
|
| case LITERALROW:
|
| @@ -89,6 +90,8 @@ NeXTDecode(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)
|
| * The scanline has a literal span that begins at some
|
| * offset.
|
| */
|
| + if( cc < 4 )
|
| + goto bad;
|
| off = (bp[0] * 256) + bp[1];
|
| n = (bp[2] * 256) + bp[3];
|
| if (cc < 4+n || off+n > scanline)
|
| @@ -101,6 +104,8 @@ NeXTDecode(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)
|
| default: {
|
| uint32 npixels = 0, grey;
|
| uint32 imagewidth = tif->tif_dir.td_imagewidth;
|
| + if( isTiled(tif) )
|
| + imagewidth = tif->tif_dir.td_tilewidth;
|
|
|
| /*
|
| * The scanline is composed of a sequence of constant
|
| @@ -138,10 +143,27 @@ bad:
|
| return (0);
|
| }
|
|
|
| +static int
|
| +NeXTPreDecode(TIFF* tif, uint16 s)
|
| +{
|
| + static const char module[] = "NeXTPreDecode";
|
| + TIFFDirectory *td = &tif->tif_dir;
|
| + (void)s;
|
| +
|
| + if( td->td_bitspersample != 2 )
|
| + {
|
| + TIFFErrorExt(tif->tif_clientdata, module, "Unsupported BitsPerSample = %d",
|
| + td->td_bitspersample);
|
| + return (0);
|
| + }
|
| + return (1);
|
| +}
|
| +
|
| int
|
| TIFFInitNeXT(TIFF* tif, int scheme)
|
| {
|
| (void) scheme;
|
| + tif->tif_predecode = NeXTPreDecode;
|
| tif->tif_decoderow = NeXTDecode;
|
| tif->tif_decodestrip = NeXTDecode;
|
| tif->tif_decodetile = NeXTDecode;
|
| @@ -157,4 +179,3 @@ TIFFInitNeXT(TIFF* tif, int scheme)
|
| * fill-column: 78
|
| * End:
|
| */
|
| -
|
|
|