Return-Path: <tiff-bounces@remotesensing.org>
Received: from inmx005.isp.belgacom.be (inmx005.isp.belgacom.be [195.238.3.148])
        by mailst034.isp.belgacom.be (8.12.11/8.12.11/Skynet-MAILSTORE-2.14) with ESMTP id i8OCZkYk025709
        for <joris.at.lebbeke@skynet.be>; Fri, 24 Sep 2004 14:35:46 +0200
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from xserve.flids.com (adsl-065-083-169-202.sip.mco.bellsouth.net [65.83.169.202])
        by inmx005.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-2.32) with ESMTP id i8OCZWwj030406
        for <joris.at.lebbeke@skynet.be>; Fri, 24 Sep 2004 14:35:35 +0200
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from adsl-065-083-169-202.sip.mco.bellsouth.net (localhost [127.0.0.1])
	by xserve.flids.com (Postfix) with ESMTP
	id 1BD14323C6A; Fri, 24 Sep 2004 08:35:19 -0400 (EDT)
X-Original-To: tiff@remotesensing.org
Delivered-To: tiff@remotesensing.org
Received: from outmx018.isp.belgacom.be (outmx018.isp.belgacom.be
	[195.238.2.117])
	by xserve.flids.com (Postfix) with ESMTP id 0DB71323C47
	for <tiff@remotesensing.org>; Fri, 24 Sep 2004 08:35:16 -0400 (EDT)
Received: from outmx018.isp.belgacom.be (localhost [127.0.0.1])
	by outmx018.isp.belgacom.be (8.12.11/8.12.11/Skynet-OUT-2.22) with
	ESMTP id i8OCZ4F4004436
	for <tiff@remotesensing.org>; Fri, 24 Sep 2004 14:35:04 +0200
	(envelope-from <joris.at.lebbeke@skynet.be>)
Received: from dfgrrxsknr4e (15.43-200-80.adsl.skynet.be [80.200.43.15])
	by outmx018.isp.belgacom.be (8.12.11/8.12.11/Skynet-OUT-2.22) with SMTP
	id i8OCZ0gA004402
	for <tiff@remotesensing.org>; Fri, 24 Sep 2004 14:35:00 +0200
	(envelope-from <joris.at.lebbeke@skynet.be>)
Message-ID: <000701c4a233$2b0312b0$0f2bc850@dfgrrxsknr4e>
From: "Joris" <joris.at.lebbeke@skynet.be>
To: "Tiff mailing list" <tiff@remotesensing.org>
Date: Fri, 24 Sep 2004 14:36:45 +0200
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
Subject: [Tiff] Possible (tiny) bug in LZW code
X-BeenThere: tiff@remotesensing.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: TIFF and libtiff discussion  <tiff.remotesensing.org>
List-Unsubscribe: <http://xserve.flids.com/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=unsubscribe>
List-Archive: <http://xserve.flids.com/pipermail/tiff>
List-Post: <mailto:tiff@remotesensing.org>
List-Help: <mailto:tiff-request@remotesensing.org?subject=help>
List-Subscribe: <http://xserve.flids.com/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=subscribe>
Sender: tiff-bounces@remotesensing.org
Errors-To: tiff-bounces@remotesensing.org
X-UIDL: bef9e7d2fc0cc3a5c3e1d8d5fbb41af4

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

_______________________________________________
Tiff mailing list
Tiff@remotesensing.org
http://xserve.flids.com/mailman/listinfo/tiff
