X-Account-Key: account1
X-UIDL: 17bcc2fdda0072f14cd5c0a625b81e50
X-Mozilla-Status: 0011
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 D2ED56721A4
	for <faxguy@howardsilvan.com>; Thu,  2 Apr 2015 19:01:12 -0700 (PDT)
Received: from lists.maptools.org ([94.23.4.142] helo=lists.maptools.org)
	by lothlorien.howardsilvan.com with SMTP (2.3.3); 2 Apr 2015	19:01:12 -0800
Received: from [10.1.0.241] (localhost.localdomain [127.0.0.1])
	by lists.maptools.org (Postfix) with ESMTP id 85CAE35C030;
	Thu,  2 Apr 2015 20:59:46 -0500 (EST)
Received: from blade.simplesystems.org (blade.simplesystems.org [65.66.246.74])
	by lists.maptools.org (Postfix) with ESMTPS id B66E935C02D
	for <tiff@lists.maptools.org>; Thu,  2 Apr 2015 20:59:37 -0500 (EST)
Received: from freddy.simplesystems.org (freddy.simplesystems.org	[65.66.246.65])
	by blade.simplesystems.org (8.14.4+Sun/8.14.4)
	with ESMTP id	t331xlGf007857; Thu, 2 Apr 2015 20:59:47 -0500 (CDT)
Date: Thu, 2 Apr 2015 20:59:47 -0500 (CDT)
From: Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
X-X-Sender: bfriesen@freddy.simplesystems.org
To: Romain Franconville <romain.franconville@gmail.com>
In-Reply-To: 
 <CANKEqfQGsHpK2rbA2bGo3ZbE294NdJ38wSjYgTuq-vBg-PyoGg@mail.gmail.com>
Message-ID: <alpine.GSO.2.01.1504022052440.4186@freddy.simplesystems.org>
References:
	<CANKEqfQGsHpK2rbA2bGo3ZbE294NdJ38wSjYgTuq-vBg-PyoGg@mail.gmail.com>
User-Agent: Alpine 2.01 (GSO 1266 2009-07-14)
MIME-Version: 1.0
Cc: tiff@lists.maptools.org
Subject: Re: [Tiff] problem reading directories past 2GB on a 64bits system
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.9
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-Assp-ID: lothlorien.howardsilvan.com m1-26472-13031
X-Assp-Session: 7FE0CEE5E448 (mail 1)
X-Assp-Detected-RIP: 65.66.246.65, 65.66.246.74
X-Assp-Source-IP: 65.66.246.65
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); 2 Apr 2015 19:01:12 -0800
X-Assp-Whitelisted: Yes (whitelistdb)
Return-Path: tiff-bounces@lists.maptools.org
Content-Type: MULTIPART/MIXED;
	BOUNDARY="-559023410-255860025-1428026387=:4186"

  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

---559023410-255860025-1428026387=:4186
Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable

On Thu, 2 Apr 2015, Romain Franconville wrote:

> I'm using libtiff 4.0-3 on Ubuntu (64bits) 14.04.
> I'm trying to read tiff files that are signed 16bits. Everything run sm=
oothly for files smaller than 2Gb. But I cannot
> access directories past that limit.
>=20
> TIFFSetDirectory returns the following error in those cases :
>=20
> =C2=A0 =C2=A0 =C2=A0TIFFFetchDirectory: Sanity check on directory count=
 failed, zero tag directories not supported.
> =C2=A0 =C2=A0 =C2=A0TIFFReadDirectory: Failed to read directory at offs=
et 256.
>=20
> Opening as bigtiff doesn't make a difference (expected since it's still=
 less than 4Gb).
>=20
> Any ideas of what might be going on ?=C2=A0

Now that I am looking at the code, I see that the directory count is=20
expected to fit in a 16-bit storage size.  Is it possible that you=20
have more than 64k entries?

This is the relevant code (after passing several other checks):

 			dircount16 =3D (uint16)dircount64;
 			dirsize =3D 20;
 		}
 		if (dircount16 =3D=3D 0 )
 		{
 			TIFFErrorExt(tif->tif_clientdata, module,
 			             "Sanity check on directory count failed, zero tag direct=
ories not supported");
 			return 0;
 		}

Bob
--=20
Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen=
/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
---559023410-255860025-1428026387=:4186
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
---559023410-255860025-1428026387=:4186--


