X-Account-Key: account1
X-UIDL: eeb427f7f685d42ea6b16257cddbbf23
X-Mozilla-Status: 0003
X-Mozilla-Status2: 00000000
X-Mozilla-Keys:                                                                                 
Received: from lists.maptools.org (lothlorien.howardsilvan.com [127.0.0.1])
	by mail.howardsilvan.com (Postfix) with ESMTPS id EF78967214D
	for <faxguy@howardsilvan.com>; Fri,  8 May 2015 10:51:43 -0700 (PDT)
Received: from lists.maptools.org ([94.23.4.142] helo=lists.maptools.org)
	by lothlorien.howardsilvan.com with SMTP (2.3.3); 8 May 2015	10:51:42 -0800
Received: from [10.1.0.241] (localhost.localdomain [127.0.0.1])
	by lists.maptools.org (Postfix) with ESMTP id 8A16535C028;
	Fri,  8 May 2015 12:51:01 -0500 (EST)
Received: from ns12.nhgdns.com (unknown [94.229.72.252])
	by lists.maptools.org (Postfix) with ESMTPS id 65CF935C024
	for <tiff@lists.maptools.org>; Fri,  8 May 2015 12:50:51 -0500 (EST)
Received: from [109.151.48.220] (port=56111 helo=Athena)	by ns12.nhgdns.com
	with esmtpa (Exim 4.80.1)	(envelope-from <andy.cave@hamillroad.com>)
	id 1YqmQS-003iri-Md; Fri, 08 May 2015 18:51:04 +0100
From: Andy Cave <andy.cave@hamillroad.com>
To: tiff@lists.maptools.org
Date: Fri, 8 May 2015 18:51:01 +0100
Organization: Hamillroad Software Limited
Message-ID: <080201d089b7$8c34dec0$a49e9c40$@hamillroad.com>
MIME-Version: 1.0
X-Mailer: Microsoft Outlook 14.0
Thread-Index: AdCJtQEdYdYDQUOrQsyWYaIrm8TWuw==
X-AntiAbuse: This header was added to track abuse,	please include it with
 any abuse report
X-AntiAbuse: Primary Hostname - ns12.nhgdns.com
X-AntiAbuse: Original Domain - lists.maptools.org
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - hamillroad.com
X-Get-Message-Sender-Via: ns12.nhgdns.com: authenticated_id:
	acave@hamillroad.com
X-Source: 
X-Source-Args: 
X-Source-Dir: 
Subject: [Tiff] Long standing bug in LibTIFF LZW compression
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.9
Precedence: list
Reply-To: andy.cave@hamillroad.com
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=subscribe>
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org
X-Assp-ID: lothlorien.howardsilvan.com m1-07503-10344
X-Assp-Session: 7FE0DD0F7F40 (mail 1)
X-Assp-Detected-RIP: 109.151.48.220, 94.229.72.252
X-Assp-Source-IP: 109.151.48.220
X-Assp-Envelope-From: tiff-bounces@lists.maptools.org
X-Assp-Intended-For: faxguy@howardsilvan.com
X-Assp-Version: 2.3.3(14029) on lothlorien.howardsilvan.com
X-Assp-Server-TLS: yes
X-Assp-Delay: not delayed (whitelisted); 8 May 2015 10:51:43 -0800
X-Assp-Whitelisted: Yes (whitelistdb)
Return-Path: tiff-bounces@lists.maptools.org
Content-Language: en-gb
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Dear All,

There is a longstanding bug in the LZW decompressor in LibTIFF. It fails to
decode files that contain two consecutive CODE_CLEAR codes. These are
allowed by the LZW spec and the same data sequence is correctly decoded by
Acrobat if you wrap the data in a PDF file.

The fix is simple: 
1. Add "do {" after the line "if (code == CODE_CLEAR) {" in both LZWDecode
and LZWDecodeCompat.
2. Add "} while (code == CODE_CLEAR);" before the line " if (code ==
CODE_EOI)" (half a dozen lines or so down from the first change) in both
LZWDecode and LZWDecodeCompat.

I have no idea how to submit a diff of the fix or fix the public domain
source, so if someone could help who knows how to, it should do no harm to
fix the bug.

Regards,

Andy.


_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/


