* tif_win32.c: Applied patch to fix overreads and ovverwrites

caught by BoundsChecker.  From Arvan Pritchard
This commit is contained in:
Mike Welles 2000-04-04 14:54:34 +00:00
parent f076e7232f
commit f0770083a2
3 changed files with 34 additions and 19 deletions

View File

@ -1,6 +1,12 @@
2000-04-04 Mike Welles <mike@onshore.com>
* tif_win32.c: Applied patch to fix overreads and ovverwrites
caught by BoundsChecker. From Arvan Pritchard
<arvan.pritchard@infomatix.co.uk> (untested).
* tif_lzw.c Applied patch to silence VC6 warnings. From
* tif_getimage.c: Applied patch to silence VC6 warnings. From
Arvan Pritchard <arvan.pritchard@informatix.co.uk>
* tif_lzw.c: Applied patch to silence VC6 warnings. From
Arvan Pritchard <arvan.pritchard@informatix.co.uk>
2000-03-28 Frank Warmerdam <warmerda@cs46980-c>

View File

@ -1,4 +1,4 @@
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_getimage.c,v 1.4 1999-11-27 21:32:10 warmerda Exp $ */
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_getimage.c,v 1.5 2000-04-04 14:54:34 mwelles Exp $ */
/*
* Copyright (c) 1991-1997 Sam Leffler
@ -1542,12 +1542,12 @@ initYCbCrConversion(TIFFRGBAImage* img)
*/
TIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRSUBSAMPLING, &hs, &vs);
switch ((hs<<4)|vs) {
case 0x44: return (putcontig8bitYCbCr44tile);
case 0x42: return (putcontig8bitYCbCr42tile);
case 0x41: return (putcontig8bitYCbCr41tile);
case 0x22: return (putcontig8bitYCbCr22tile);
case 0x21: return (putcontig8bitYCbCr21tile);
case 0x11: return (putcontig8bitYCbCr11tile);
case 0x44: return (&putcontig8bitYCbCr44tile);
case 0x42: return (&putcontig8bitYCbCr42tile);
case 0x41: return (&putcontig8bitYCbCr41tile);
case 0x22: return (&putcontig8bitYCbCr22tile);
case 0x21: return (&putcontig8bitYCbCr21tile);
case 0x11: return (&putcontig8bitYCbCr11tile);
}
return (NULL);
}

View File

@ -1,4 +1,4 @@
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_win32.c,v 1.5 2000-01-28 21:42:48 warmerda Exp $ */
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_win32.c,v 1.6 2000-04-04 14:54:34 mwelles Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -152,7 +152,7 @@ TIFF*
TIFFFdOpen(int ifd, const char* name, const char* mode)
{
TIFF* tif;
BOOL fSuppressMap = (mode[1] == 'u' || mode[2] == 'u');
BOOL fSuppressMap = (mode[1] == 'u' || (mode[1]!=0 && mode[2] == 'u'));
tif = TIFFClientOpen(name, mode,
(thandle_t)ifd,
@ -225,9 +225,18 @@ tdata_t
_TIFFrealloc(tdata_t p, tsize_t s)
{
void* pvTmp;
if ((pvTmp = GlobalReAlloc(p, s, 0)) == NULL) {
tsize_t old=GlobalSize(p);
if (old>=s)
{
if ((pvTmp = GlobalAlloc(GMEM_FIXED, s)) != NULL) {
CopyMemory(pvTmp, p, GlobalSize(p));
CopyMemory(pvTmp, p, s);
GlobalFree(p);
}
}
else
{
if ((pvTmp = GlobalAlloc(GMEM_FIXED, s)) != NULL) {
CopyMemory(pvTmp, p, old);
GlobalFree(p);
}
}