* libtiff/tif_lzw.c: fix 4.0.8 regression in the decoding of old-style LZW

compressed files.
This commit is contained in:
Even Rouault 2017-07-11 08:55:07 +00:00
parent d69a373ecf
commit 311af0ba08
2 changed files with 10 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2017-07-11 Even Rouault <even.rouault at spatialys.com>
* libtiff/tif_lzw.c: fix 4.0.8 regression in the decoding of old-style LZW
compressed files.
2017-07-10 Even Rouault <even.rouault at spatialys.com> 2017-07-10 Even Rouault <even.rouault at spatialys.com>
* libtiff/tif_pixarlog.c: avoid excessive memory allocation on decoding * libtiff/tif_pixarlog.c: avoid excessive memory allocation on decoding

View File

@ -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 * 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; bp = (unsigned char *)tif->tif_rawcp;
#ifdef LZW_CHECKEOS
sp->dec_bitsleft = (((uint64)tif->tif_rawcc) << 3);
#endif
nbits = sp->lzw_nbits; nbits = sp->lzw_nbits;
nextdata = sp->lzw_nextdata; nextdata = sp->lzw_nextdata;
nextbits = sp->lzw_nextbits; 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; tif->tif_rawcp = (uint8*) bp;
sp->lzw_nbits = (unsigned short)nbits; sp->lzw_nbits = (unsigned short)nbits;
sp->lzw_nextdata = nextdata; sp->lzw_nextdata = nextdata;