2004.09.24 12:36 "[Tiff] Possible (tiny) bug in LZW code", by Joris Van Damme

2004.09.24 12:36 "[Tiff] Possible (tiny) bug in LZW code", by Joris Van Damme

People,

In tiff_lzw.c, inside LZWPreDecode, there is zeroing of memory of the code table, passed the initial entries. A comment describes the reason why:

/*
* Zero entries that are not yet filled in.  We do
* this to guard against bogus input data that causes
* us to index into undefined entries.  If you can
* come up with a way to safely bounds-check input codes
* while decoding then you can remove this operation.
*/

If this is so, then shouldn't the same reasoning apply after receiving a CODE_CLEAR and resetting the table, in LZWDecode as well as in LZWDecodeCompat? Or am I misunderstanding things?

Joris Van Damme
info@awaresystems.be
http://www.awaresystems.be
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html