* tools/thumbnail.c: Eliminate crash noticed while running test

suite.
This commit is contained in:
Bob Friesenhahn 2008-12-30 22:20:35 +00:00
parent bb9ee50811
commit f44e642634
3 changed files with 27 additions and 7 deletions

View File

@ -1,3 +1,8 @@
2008-12-30 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
* tools/thumbnail.c: Eliminate crash noticed while running test
suite.
2008-12-29 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
* libtiff/tif_ojpeg.c (OJPEGLibjpegJpegSourceMgrFillInputBuffer):

View File

@ -1,4 +1,4 @@
/* $Id: tif_dirwrite.c,v 1.69 2008-09-01 23:18:20 fwarmerdam Exp $ */
/* $Id: tif_dirwrite.c,v 1.70 2008-12-30 22:20:35 bfriesen Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -1740,9 +1740,10 @@ TIFFWriteDirectoryTagSubifd(TIFF* tif, uint32* ndir, TIFFDirEntry* dir)
}
pa=tif->tif_dir.td_subifd;
pb=o;
for (p=0; p<tif->tif_dir.td_nsubifd; p++)
for (p=0; p < tif->tif_dir.td_nsubifd; p++)
{
assert(*pa<=0xFFFFFFFFUL);
assert(pa != 0);
assert(*pa <= 0xFFFFFFFFUL);
*pb++=(uint32)(*pa++);
}
n=TIFFWriteDirectoryTagCheckedIfdArray(tif,ndir,dir,TIFFTAG_SUBIFD,tif->tif_dir.td_nsubifd,o);

View File

@ -1,4 +1,4 @@
/* $Id: thumbnail.c,v 1.10 2008-05-23 17:24:41 fwarmerdam Exp $ */
/* $Id: thumbnail.c,v 1.11 2008-12-30 22:20:35 bfriesen Exp $ */
/*
* Copyright (c) 1994-1997 Sam Leffler
@ -161,6 +161,16 @@ cpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)
CopyField(tag, longv);
}
break;
case TIFF_LONG8:
{ uint64 longv8;
CopyField(tag, longv8);
}
break;
case TIFF_SLONG8:
{ int64 longv8;
CopyField(tag, longv8);
}
break;
case TIFF_RATIONAL:
if (count == 1) {
float floatv;
@ -184,7 +194,11 @@ cpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)
CopyField(tag, doubleav);
}
break;
default:
case TIFF_IFD8:
{ toff_t ifd8;
CopyField(tag, ifd8);
}
break; default:
TIFFError(TIFFFileName(in),
"Data type %d is not supported, tag %d skipped.",
tag, type);
@ -555,7 +569,7 @@ generateThumbnail(TIFF* in, TIFF* out)
uint16 bps, spp;
tsize_t rowsize, rastersize;
tstrip_t s, ns = TIFFNumberOfStrips(in);
uint32 diroff[1];
toff_t diroff[1];
TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &sw);
TIFFGetField(in, TIFFTAG_IMAGELENGTH, &sh);
@ -596,7 +610,7 @@ generateThumbnail(TIFF* in, TIFF* out)
cpTag(in, out, TIFFTAG_IMAGEDESCRIPTION, (uint16) -1, TIFF_ASCII);
cpTag(in, out, TIFFTAG_DATETIME, (uint16) -1, TIFF_ASCII);
cpTag(in, out, TIFFTAG_HOSTCOMPUTER, (uint16) -1, TIFF_ASCII);
diroff[0] = 0;
diroff[0] = 0UL;
TIFFSetField(out, TIFFTAG_SUBIFD, 1, diroff);
return (TIFFWriteEncodedStrip(out, 0, thumbnail, tnw*tnh) != -1 &&
TIFFWriteDirectory(out) != -1);