Return-Path: <tiff-bounces@lists.maptools.org>
X-Original-To: info@awaresystems.be
Delivered-To: info@awaresystems.be
Received: from mx-i.b-one.net (mx-i.one.com [91.198.169.56])
	by mail9.b-one.net (Postfix) with ESMTP id F3181400125
	for <info@awaresystems.be>; Fri, 27 Feb 2009 00:05:15 +0100 (CET)
X-Virus-Scanned: by one.com
X-Spam-Score: 0
X-Spam-Level: 
X-Spam-Status: No, score=0 tagged_above=0 required=6 tests=[none]
X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4
Received: from lists.maptools.org (lists.maptools.org [65.39.174.144])
	by mx-i.b-one.net (Postfix) with ESMTP id 32C7E8CDF
	for <info@awaresystems.be>; Fri, 27 Feb 2009 00:05:15 +0100 (CET)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by lists.maptools.org (Postfix) with ESMTP id 665C61D203BFC;
	Thu, 26 Feb 2009 18:03:11 -0500 (EST)
Received: from csmtp3.b-one.net (csmtp3.one.com [195.47.247.213])
	by lists.maptools.org (Postfix) with ESMTP id EDC251D203CFB
	for <tiff@lists.maptools.org>; Thu, 26 Feb 2009 17:47:24 -0500 (EST)
Received: from awarec74cb3e1c (78-21-195-100.access.telenet.be [78.21.195.100])
	by csmtp3.b-one.net (Postfix) with ESMTP id B9F49240D27E;
	Thu, 26 Feb 2009 23:47:17 +0100 (CET)
Message-ID: <72E191FA9BD34B078B386C02333EF6A4@awarec74cb3e1c>
From: "Joris Van Damme \(AWare Systems\)" <info@awaresystems.be>
To: "Frank Warmerdam" <warmerdam@pobox.com>
References: <498B321F.3000300@pobox.com><42278D87AFEF4967BEDF2905FA68A6D3@awarec74cb3e1c>
	<498C4FAA.8060700@pobox.com>
Date: Thu, 26 Feb 2009 23:44:38 +0100
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2900.5512
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
Cc: TIFF mailing list <tiff@lists.maptools.org>
Subject: Re: [Tiff] assertions, and building with DEBUG/NDEBUG
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>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org

Frank, folks,

> http://bugzilla.maptools.org/show_bug.cgi?id=1994

There's been no response on my proposed fix, in the mailing list nor on 
bugzilla. But I need LibTiff to not crash on me, for crosstesting, so I did 
a quick hack that is even shorter and easier then the fix I proposed before 
as I realized we don't actually need to sort. We merely have to keep away 
duplicate tags, for IGNORE to work. So we could simply keep away the 
duplicates by flagging them IGNORE prior to any other processing. I inserted 
the following few lines in the TIFFReadDirectory function, in tif_dirread.c, 
near the top of that function right between the call to 
TIFFReadDirectoryCheckOrder and the partial resetting of tif->tif_flags.

{
 TIFFDirEntry* ma;
 uint16 mb;
 for (ma=dir, mb=0; mb<dircount; ma++, mb++)
 {
  TIFFDirEntry* na;
  uint16 nb;
  for (na=ma+1, nb=mb+1; nb<dircount; na++, nb++)
  {
   if (ma->tdir_tag==na->tdir_tag)
    na->tdir_tag=IGNORE;
  }
 }
}

That does not just solve this problem, it'll solve all problems with 
duplicate instances of any special tag, and means the IGNORE mechanism works 
as intented. Someone with CVS write access please consider this fix.


Best regards,

Joris

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