Received: from [192.48.153.1] by phillip.thumbsplus.com (NTMail 3.03.0017/7.aaxh) with ESMTP id pcrews for <pcrews@cerious.com>; Tue, 7 Apr 1998 07:40:26 -0400
Received: from cthulhu.engr.sgi.com (cthulhu.engr.sgi.com [192.26.80.2]) by sgi.sgi.com (980309.SGI.8.8.8-aspam-6.2/980304.SGI-aspam) via ESMTP id EAA23555; Tue, 7 Apr 1998 04:23:52 -0700 (PDT)
	mail_from (owner-tiff@sgi.engr.sgi.com)
Received: (from majordomo-owner@localhost)
	by cthulhu.engr.sgi.com (980205.SGI.8.8.8/970903.SGI.AUTOCF) id DAA8745119
	for tiff-list;
	Tue, 7 Apr 1998 03:23:31 -0700 (PDT)
Received: from sgi.sgi.com (sgi.engr.sgi.com [192.26.80.37])
	by cthulhu.engr.sgi.com (980205.SGI.8.8.8/970903.SGI.AUTOCF)
	via ESMTP id DAA8808455
	for <tiff-relay@cthulhu.engr.sgi.com>;
	Tue, 7 Apr 1998 03:23:30 -0700 (PDT)
Received: from mailout02.btx.dtag.de (mailout02.btx.dtag.de [194.25.2.150]) by sgi.sgi.com (980309.SGI.8.8.8-aspam-6.2/980304.SGI-aspam) via SMTP id DAA13718
	for <tiff@sgi.com>; Tue, 7 Apr 1998 03:23:28 -0700 (PDT)
	mail_from (EchoTech@t-online.de)
Received: from fwd00.btx.dtag.de (fwd00.btx.dtag.de [194.25.2.160])
	by mailout02.btx.dtag.de with smtp 
	id 0yMVTE-00028H-00; Tue, 7 Apr 1998 12:19:12 +0200
Received: from unknown-186-1.wrs.com (081155560-0001(btxid)@[193.158.169.48]) 
	by fwd00.btx.dtag.de with smtp
	id <m0yMVSy-0005uPC>; Tue, 7 Apr 1998 12:18:56 +0200
Received: by unknown-186-1.wrs.com with Microsoft Mail
	id <01BD621F.6B844260@unknown-186-1.wrs.com>; Tue, 7 Apr 1998 12:19:32 +0200
Message-ID: <01BD621F.6B844260@unknown-186-1.wrs.com>
To: "'tiff@sgi.com'" <tiff@sgi.com>
Subject: Bug in V3.4 for WinNT
Date: Tue, 7 Apr 1998 12:18:57 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
X-Sender: 081155560-0001@t-online.de
From: EchoTech@t-online.de (EchoTech)
Sender: owner-tiff@fddi-sgi.sgi.com
Precedence: bulk

I found a bug in libtiff V3.4 running on WindowsNT.

In tif_win32.c change:

tdata_t
_TIFFrealloc(tdata_t p, tsize_t s)
{
	void* pvTmp;
	if ((pvTmp = GlobalReAlloc(p, s, 0)) == NULL) {
		if ((pvTmp = GlobalAlloc(GMEM_FIXED, s)) != NULL) {
			CopyMemory(pvTmp, p, s);
			GlobalFree(p);
		}
	}
	return ((tdata_t)pvTmp);
}

to 

tdata_t
_TIFFrealloc(tdata_t p, tsize_t s)
{
	void* pvTmp;
	if ((pvTmp = GlobalReAlloc(p, s, 0)) == NULL) {
		if ((pvTmp = GlobalAlloc(GMEM_FIXED, s)) != NULL) {
			CopyMemory(pvTmp, p, GlobalSize(p));
			GlobalFree(p);
		}
	}
	return ((tdata_t)pvTmp);
}

Otherwise this function must fail, if the new memory block is larger than the old one and we copy from the old block the size of the new  block to the new block.

Christof Krug

EchoTech 3D Imaging Systems GmbH
Zeppelinstr. 4
D-85399 Hallbergmoos
Germany
Phone ++49 (0)811 5556 0
Fax   ++49 (0)811 5556 20
eMail EchoTech@t-online.de
WWW   http://home.t-online.de/home/EchoTech

