Return-Path: <tiff-bounces@remotesensing.org>
Received: from inav001.isp.belgacom.be (inav001.isp.belgacom.be [195.238.3.91])
        by mailst035.isp.belgacom.be (8.12.11/8.12.11/Skynet-MAILSTORE-2.14) with ESMTP id i9SIjk99010633
        for <joris.at.lebbeke@skynet.be>; Thu, 28 Oct 2004 20:45:46 +0200
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from inas001.isp.belgacom.be (localhost [127.0.0.1])
        by inav001.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-AV-3.00) with ESMTP id i9SIjeq5012354
        for <joris.at.lebbeke@skynet.be>; Thu, 28 Oct 2004 20:45:40 +0200
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from inmx016.isp.belgacom.be (inmx016.isp.belgacom.be [195.238.2.219])
        by inas001.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-AS-2.03) with ESMTP id i9SIjS27027795
        for <joris.at.lebbeke@skynet.be>; Thu, 28 Oct 2004 20:45:30 +0200
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from xserve.flids.com (adsl-065-083-169-202.sip.mco.bellsouth.net [65.83.169.202])
        by inmx016.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-2.32) with ESMTP id i9SIjFnL030612
        for <joris.at.lebbeke@skynet.be>; Thu, 28 Oct 2004 20:45:17 +0200
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from adsl-065-083-169-202.sip.mco.bellsouth.net (localhost [127.0.0.1])
	by xserve.flids.com (Postfix) with ESMTP
	id AE56C41DB6E; Thu, 28 Oct 2004 14:44:56 -0400 (EDT)
X-Original-To: tiff@remotesensing.org
Delivered-To: tiff@remotesensing.org
Received: from ahk.pu.ru (unknown [195.70.196.198])
	by xserve.flids.com (Postfix) with ESMTP id 3A1A341DB4B
	for <tiff@remotesensing.org>; Thu, 28 Oct 2004 14:44:54 -0400 (EDT)
Received: from wg.pu.ru (wg.pu.ru [193.124.85.219])
	by ahk.pu.ru (8.12.11/8.12.9) with ESMTP id i9SIirbb068149
	for <tiff@remotesensing.org>; Thu, 28 Oct 2004 22:44:53 +0400 (MSD)
	(envelope-from dron@ak4719.spb.edu)
Received: (from uucp@localhost)
	by wg.pu.ru (8.9.1a/8.9.1) with UUCP id SAA21410
	for tiff@remotesensing.org; Thu, 28 Oct 2004 18:44:53 GMT
Received: from ak4719.spb.edu (localhost [127.0.0.1])
	by ak4719.spb.edu (8.12.11/8.12.11/Debian-5) with ESMTP id
	i9SIZCnT017182
	for <tiff@remotesensing.org>; Thu, 28 Oct 2004 22:35:12 +0400
Received: (from dron@localhost)
	by ak4719.spb.edu (8.12.11/8.12.11/Debian-5) id i9SIZCoH017179
	for tiff@remotesensing.org; Thu, 28 Oct 2004 22:35:12 +0400
From: Andrey Kiselev <dron@ak4719.spb.edu>
Date: Thu, 28 Oct 2004 22:35:12 +0400
To: tiff@remotesensing.org
Subject: Re: [Tiff] TIFFTAG_PHOTOSHOP
Message-ID: <20041028183512.GA11660@ak4719.spb.edu>
Mail-Followup-To: tiff@remotesensing.org
References: <6.1.2.0.2.20041023150618.027a9000@pop.earthlink.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <6.1.2.0.2.20041023150618.027a9000@pop.earthlink.net>
X-GnuPG-Key: http://www.srces.spb.org/dron/export.home.key
X-Face: "t+se9s~+y~[XUH]L|pmeO3Pt/Q@DNv**S, d@_1-C=}/,
	c%<3Qp]eu!ok<"2lYJm$!9qVcg F?7o*L; |$`6|Q|>Rt-cU%2_y@6tQ|`!Li}TsvZvEKx;
	>fuY=fc(=sX^`7Wmw8%SsR`AvM$a; 0U/eN\ P?B\FTyqD, 0np$U2!*'z_4D,
	VPlFf?bN0&zYf"zF0s!7Tl7?$we)xD0@lL>[h|8bhys0i.g|zLnu@C
	Ti@d]i=[!:j1CB\5/TF[m]`lfHfaqSN[0qn@T3zeosV/[LAss{@p_?],x*j8P_9t[}uHD^X-;
	j~\M! gyTly;fj`}&Y~i{<#bN.#QmkE}#T`dxP.I1\.)_MEN{@#W
User-Agent: Mutt/1.5.6+20040722i
X-Virus-Scanned: clamd / ClamAV version 0.75-1, clamav-milter version 0.75c
	on ak4719
X-Virus-Status: Clean
X-BeenThere: tiff@remotesensing.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: TIFF and libtiff discussion  <tiff.remotesensing.org>
List-Unsubscribe: <http://xserve.flids.com/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=unsubscribe>
List-Archive: <http://xserve.flids.com/pipermail/tiff>
List-Post: <mailto:tiff@remotesensing.org>
List-Help: <mailto:tiff-request@remotesensing.org?subject=help>
List-Subscribe: <http://xserve.flids.com/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=subscribe>
Sender: tiff-bounces@remotesensing.org
Errors-To: tiff-bounces@remotesensing.org
X-UIDL: 30256e35413c642ab0bfe83fa9505637

On Sat, Oct 23, 2004 at 03:21:22PM -0400, Chris Losinger wrote:
> 	i'm trying to set some data into the Photoshop tag:
> 
> 	TIFFSetField(tiff, TIFFTAG_PHOTOSHOP, (unsigned long)dataSize, (void 
> *)dataPointer);
> 
> 	that call works fine. but when i go to close the file 
> 	(TIFFClose(tiff)) , LibTiff crashes in _TIFFVGetField. the bug seems to 
> happen here:
> 
> ...snip
>  	case TIFFTAG_PHOTOSHOP:
>             *va_arg(ap, uint32*) = td->td_photoshopLength;
>             *va_arg(ap, void**) = td->td_photoshopData;
>             break;
> ...snip
> 
> 	the values of td_photoshopLength is right and td_photoshopData 
> 	points to a copy of my data.
> 
> call stack:
> _TIFFVGetField(tiff * 0x00f6fd58, unsigned long 34377, char * 0x0012eb48) 
> line 884
> TIFFVGetField(tiff * 0x00f6fd58, unsigned long 34377, char * 0x0012eb48) 
> line 1004 + 88 bytes
> TIFFGetField(tiff * 0x00f6fd58, unsigned long 34377) line 988 + 17 bytes
> TIFFWriteNormalTag(tiff * 0x00f6fd58, TIFFDirEntry * 0x0116150c, const 
> TIFFFieldInfo * 0x009f6a34) line 590 + 23 bytes
> _TIFFWriteDirectory(tiff * 0x00f6fd58, int 1) line 346 + 17 bytes
> TIFFWriteDirectory(tiff * 0x00f6fd58) line 415 + 11 bytes
> TIFFFlush(tiff * 0x00f6fd58) line 40 + 22 bytes
> TIFFClose(tiff * 0x00f6fd58) line 39 + 9 bytes
> 
> 	but it looks like the va_arg stuff totally hoses the stack. after 
> 	the first va_arg line, i lose half the stack. after the other, i lose 
> another 1/4. and, this problem on happens in debug mode. it seems to run 
> fine in release mode. (VC6, sp6). BoundsChecker doesn't tell me anything.
> 
> 	but, if i change the TIFFTAG_PHOTOSHOP definition to a 
> 	TIFF_UNDEFINED instead of TIFF_BYTE , it runs fine.

Ok, I have digged into this once again. Chris, could you change your code
like this:

	TIFFSetField(tiff, TIFFTAG_PHOTOSHOP,
		     (unsigned short)dataSize, (void *)dataPointer);
		     ^^^^^^^^^^^^^^^^

and report whether it fixes (or not) your problem? It seems that I have
found a bug but the correct solution needs some more work.

						Andrey

-- 
Andrey V. Kiselev
Home phone:  +7 812 5274898  ICQ# 26871517
_______________________________________________
Tiff mailing list
Tiff@remotesensing.org
http://xserve.flids.com/mailman/listinfo/tiff
