diff options
| author | Aaron Boxer <boxerab@gmail.com> | 2014-12-09 14:33:38 -0500 |
|---|---|---|
| committer | Antonin Descampe <antonin@gmail.com> | 2015-07-03 19:19:17 +0200 |
| commit | 6b0a8e3a0fc0dd18b01a8810b6867d6da8fa79e4 (patch) | |
| tree | 4e34a268505357dad2498cf97580e72948cc4c1a /thirdparty/libtiff/tif_next.c | |
| parent | eadfad7a5014e0bf2a56667194af976fc9fc987c (diff) | |
upgraded to libtiff v4.0.4
Diffstat (limited to 'thirdparty/libtiff/tif_next.c')
| -rw-r--r-- | thirdparty/libtiff/tif_next.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/thirdparty/libtiff/tif_next.c b/thirdparty/libtiff/tif_next.c index 524e127c..17e03111 100644 --- a/thirdparty/libtiff/tif_next.c +++ b/thirdparty/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 @@ -71,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: @@ -90,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) @@ -102,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 @@ -139,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; |
