Return-Path: <tiff-bounces@lists.maptools.org>
Received: from inas019.isp.belgacom.be (localhost [127.0.0.1])
        by inav004.isp.belgacom.be (8.12.11.20060308/8.12.11/Skynet-IN-AV-3.00) with ESMTP id k9RJeHqB025715
        for <joris.at.lebbeke@skynet.be>; Fri, 27 Oct 2006 21:40:17 +0200
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from inmx011.isp.belgacom.be (inmx011.isp.belgacom.be [195.238.5.50])
        by inas019.isp.belgacom.be (8.12.11.20060308/8.12.11/Skynet-IN-AS-2.03) with ESMTP id k9RJeEKo003650
        for <joris.at.lebbeke@skynet.be>; Fri, 27 Oct 2006 21:40:14 +0200
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from duke.maptools.org (r153.dmsolutions.ca [209.217.116.153] (may be forged))
        by inmx011.isp.belgacom.be (8.12.11.20060308/8.12.11/Skynet-IN-2.32) with ESMTP id k9RJeBCl017931
        for <joris.at.lebbeke@skynet.be>; Fri, 27 Oct 2006 21:40:12 +0200
        (envelope-from <tiff-bounces@lists.maptools.org>)
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 k9RJBUFP010898;
	Fri, 27 Oct 2006 15:12:53 -0400
Received: from fmmailgate03.web.de (fmmailgate03.web.de [217.72.192.234])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id k9RJBSfv010895
	for <tiff@lists.maptools.org>; Fri, 27 Oct 2006 15:11:28 -0400
Received: from smtp07.web.de (fmsmtp07.dlan.cinetic.de [172.20.5.215])
	by fmmailgate03.web.de (Postfix) with ESMTP id 031262F4196F
	for <tiff@lists.maptools.org>; Fri, 27 Oct 2006 21:11:27 +0200 (CEST)
Received: from [132.230.21.137] (helo=[132.230.21.137])
	by smtp07.web.de with asmtp (WEB.DE 4.107 #114) id 1GdX70-0007ab-00
	for tiff@lists.maptools.org; Fri, 27 Oct 2006 21:11:26 +0200
Message-ID: <454259DE.9010102@web.de>
Date: Fri, 27 Oct 2006 21:11:26 +0200
From: Sebastian Boehmer <sebastian.boehmer@web.de>
User-Agent: Thunderbird 1.5.0.7 (X11/20060911)
MIME-Version: 1.0
To: Tiff <tiff@lists.maptools.org>
Subject: Re: [Tiff] TIFFReadPrivateDirectory function is not working for SUBIFD
References: <11848b2f0610260821m892170ey7e8107f031b6dbb1@mail.gmail.com>	<4540FFC2.40603@web.de>
	<11848b2f0610262334p2ecf2639q6f57432e433eebc0@mail.gmail.com>
In-Reply-To: <11848b2f0610262334p2ecf2639q6f57432e433eebc0@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Sender: sebastian.boehmer@web.de
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.00001cba
X-MSP-STORE: Fri, 27 Oct 2006 21:40:22 +0200
Status:   

Anurag Singh schrieb:
>  
> one another important issue comes, i have made one change in
> __TIFFReadCustomDirectoryPart for our own purpose to read subifd, 
> it's very true that at the time of reading any SubIFD , there's no one
> tag is registered, because we  are passing these parameters
> tif->tif_nPrivateFields, tif->tif_privateFieldInfo, which  are
> initially NULL.
ok that's no prob. In a first call of
__TIFFMergeFieldInfo(&tif->tif_nPrivateFields,&tif->tif_privateFieldInfo,n,info,1)

is tif_nPrivateFields=0 and tif_privateFieldInfo=NULL, but n is not zero
and info is not NULL.
If info=NULL and n not zero there was a wrong call of the function
TIFFMergePrivateFieldInfo.
    n should be the size of the new to merged info.

>  
> So each n very time tag goes to merge by using
> TIFFMergePrivateFieldInfo() and in turn this  function make call 
> __TIFFMergeFieldInfo(&tif->tif_nPrivateFields,&tif->tif_privateFieldInfo,n,info,1)
> , after merging 2-3 times , i got HEAP error in this funtion, and
> reason of it, mergedIndices is currupted.
> i want explain it, we are merging one tag each n every time, so here
> n=1 and info have one tag only.
You mean you call the TIFFMergedPrivateFieldInfo n times with the same tag?
The sorted array tif->tif_privateFieldInfo contains only tags with
unique tag numbers!
For this reason we check in the loop you quoted below if info contains a
new tag.
>  
> I think problem is here. this is the code of  function
> __TIFFMergeFieldInfo
>  
Sorry I don't realy understand your problem. Perhapse could you explain
it for me in a private e-mail.
--
greets
>
> if
>
> ( support ) {
>
> mergedIndices = _TIFFmalloc(n*
>
> sizeof(int));
>
> }
>
> if (*nfields > 0) {
> if ( support ) {
>
> /*
>
> * Merge only not already existing tags. Asume unsorted TIFFFieldInfo
> array.
>
> */
>
> for (fi=0; fi < *nfields; ++fi) {      for (i =0; i < n; ++i)        
> if (info_new[i].field_tag == (*info)[fi]->field_tag)        break;    
> if ( i >= n ) { // entry not found
>
>     mergedIndices[nn] = i;
>
> // remember index
>
>    ++nn;
>
> }
>
> }
>
> if ( nn == 0 ) goto end; // no new entries;
>
> n = nn;
>
> }
>
>  
> we are allocationg memory to mergedIndices of size n, mean in the
> SubIFD's case 1 and adding more than value, here is some logical error
> for tha case when only one tag is merged in a group.
>  
> Please have a look on this problem.
>  
> Anurag
>  
>  
>  
>  
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tiff mailing list: Tiff@lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/tiff
> http://www.remotesensing.org/libtiff/

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