Received: from mailgate002.isp.belgacom.be (mailgate002.isp.belgacom.be [195.238.6.87])
	by maildelivery010.isp.belgacom.be (Postfix) with ESMTP id 06A541DC005
	for <joris.at.lebbeke@skynet.be>; Mon, 18 Feb 2008 04:30:04 +0100 (CET)
Authentication-Results: in.mx.skynet.be; dkim=neutral (message not signed) header.i=none
Received: from r153.dmsolutions.ca (HELO duke.maptools.org) ([209.217.116.153])
  by in.mx.skynet.be with ESMTP; 18 Feb 2008 04:30:03 +0100
Received: from duke.maptools.org (duke.maptools.org [127.0.0.1])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id m1I3Fmqn018461;
	Sun, 17 Feb 2008 22:16:19 -0500
Received: from rune.pobox.com (rune.pobox.com [208.210.124.79])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id m1I3Fd2S018458
	for <tiff@lists.maptools.org>; Sun, 17 Feb 2008 22:15:39 -0500
Received: from rune.listbox.com (localhost [127.0.0.1])
	by rune.pobox.com (Postfix) with ESMTP id 0A8B819C50C;
	Sun, 17 Feb 2008 22:15:58 -0500 (EST)
Received: from [192.168.2.4] (dpc674728121.direcpc.com [67.47.28.121]) (using
	TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client
	certificate
	requested) by rune.sasl.smtp.pobox.com (Postfix) with ESMTP id
	8963119C4CC; Sun, 17 Feb 2008 22:15:49 -0500 (EST)
Message-ID: <47B8F844.6080803@pobox.com>
Date: Sun, 17 Feb 2008 22:15:16 -0500
From: Frank Warmerdam <warmerdam@pobox.com>
User-Agent: Thunderbird 2.0.0.6 (X11/20071022)
MIME-Version: 1.0
To: Mick_ONeill@technologyonecorp.com
Subject: Re: [Tiff] TIFFRead errors on faxes
References: <6623A6CB0A733746B799DE82F65583190CAAB3@briavdmail01.technologyonecorp.com>
In-Reply-To: <6623A6CB0A733746B799DE82F65583190CAAB3@briavdmail01.technologyonecorp.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: tiff@lists.maptools.org
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.4
Precedence: list
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-UIDL: 000000000023ceae.00002ac5
X-MSP-STORE: Mon, 18 Feb 2008 04:30:04 +0100
Status:   

Mick O'Neill wrote:
> Once again, I have some TIFF files that cannot be read. These TIFFs have
> come in through the Faxman faxing software, and when I try to read them
> through the 3.9.0 beta library, Page 2 reports a "Read error on line
> xxx: Expected bbb, got ccc" error. Brava Reader and Autovue can view
> these images ok.
> 
> Sample tiff files available from http://midimick.com/temp/fax1.tif and
> http://midimick.com/temp/fax2.tif

Mick,

I just looked at fax1.tif.  The file is 68445 bytes in length.  The first
directory (page) looks fine.  The second is:

Directory 1: offset 68247 (0x10a97) next 0 (0)
SubFileType (254) LONG (4) 1<0>
ImageWidth (256) SHORT (3) 1<1728>
ImageLength (257) SHORT (3) 1<2287>
BitsPerSample (258) SHORT (3) 1<1>
Compression (259) SHORT (3) 1<3>
Photometric (262) SHORT (3) 1<0>
FillOrder (266) SHORT (3) 1<2>
StripOffsets (273) LONG (4) 1<30797>
SamplesPerPixel (277) SHORT (3) 1<1>
RowsPerStrip (278) SHORT (3) 1<2287>
StripByteCounts (279) LONG (4) 1<68197>
XResolution (282) RATIONAL (5) 1<200>
YResolution (283) RATIONAL (5) 1<192>
Group3Options (292) LONG (4) 1<4>
ResolutionUnit (296) SHORT (3) 1<2>
Software (305) ASCII (2) 34<ImageMan by Data Techniq ...>

Note that the StripOffsets is 30767 and the strip size is 68197.
This would only be reasonable if the file was at least 68187+30767
bytes in length, but in fact it is much shorter than that.

My conclusion is that the file is corrupt and was incorrectly
constructed.

I suspect other packages are more forgiving of this problem and
successfully decode the second page from the available data while
it seems that libtiff is promptly giving up on the second page
due to the io error.

I observe that tiff2rgba does handle the first page just fine.

BTW, packages that only operate on the first page will likely be
fine.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org

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