diff --git a/ChangeLog b/ChangeLog index b0c84977..c5c74af7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2017-07-11 Even Rouault + + * libtiff/tif_lzw.c: fix 4.0.8 regression in the decoding of old-style LZW + compressed files. + 2017-07-10 Even Rouault * libtiff/tif_pixarlog.c: avoid excessive memory allocation on decoding diff --git a/libtiff/tif_lzw.c b/libtiff/tif_lzw.c index 5f1acf83..118ac696 100644 --- a/libtiff/tif_lzw.c +++ b/libtiff/tif_lzw.c @@ -1,4 +1,4 @@ -/* $Id: tif_lzw.c,v 1.55 2017-05-17 09:38:58 erouault Exp $ */ +/* $Id: tif_lzw.c,v 1.56 2017-07-11 08:55:07 erouault Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -655,6 +655,9 @@ LZWDecodeCompat(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s) } bp = (unsigned char *)tif->tif_rawcp; +#ifdef LZW_CHECKEOS + sp->dec_bitsleft = (((uint64)tif->tif_rawcc) << 3); +#endif nbits = sp->lzw_nbits; nextdata = sp->lzw_nextdata; nextbits = sp->lzw_nextbits; @@ -764,6 +767,7 @@ LZWDecodeCompat(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s) } } + tif->tif_rawcc -= (tmsize_t)( (uint8*) bp - tif->tif_rawcp ); tif->tif_rawcp = (uint8*) bp; sp->lzw_nbits = (unsigned short)nbits; sp->lzw_nextdata = nextdata;