improve tag buffer allocation safety (#1998)

This commit is contained in:
Frank Warmerdam 2009-02-09 14:29:08 +00:00
parent 5d40e67e89
commit a62c54d6f8
2 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2009-02-09 Frank Warmerdam <warmerdam@pobox.com>
* libtiff/tif_dirread.c: Improve allocation safety when allocated
buffer for large tags. (#1998) Related to (#1993)
2009-02-06 Frank Warmerdam <warmerdam@pobox.com>
* tools/tiffcrop.c: Don't default image->res_unit to INCH. Now the

View File

@ -1,4 +1,4 @@
/* $Id: tif_dirread.c,v 1.152 2009-02-05 20:13:44 fwarmerdam Exp $ */
/* $Id: tif_dirread.c,v 1.153 2009-02-09 14:29:08 fwarmerdam Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -780,7 +780,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryArray(TIFF* tif, TIFFDirEntry* d
*count=(uint32)direntry->tdir_count;
datasize=(*count)*typesize;
assert((tmsize_t)datasize>0);
data=_TIFFmalloc(datasize);
data=_TIFFCheckMalloc(tif, *count, typesize, "ReadDirEntryArray");
if (data==0)
return(TIFFReadDirEntryErrAlloc);
if (!(tif->tif_flags&TIFF_BIGTIFF))