improve error report with zero tag directories

This commit is contained in:
Frank Warmerdam 2011-05-24 13:35:30 +00:00
parent 9437f9db5a
commit f8a3650a7c
2 changed files with 12 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2011-05-24 Frank Warmerdam <warmerdam@pobox.com>
* libtiff/tif_dirread.c: produce special error message for zero tag
directories instead of error out on the malloc(0) failure.
2011-05-16 Frank Warmerdam <warmerdam@pobox.com>
* libtiff/tif_dirinfo.c: Restore TIFFMergeFieldInfo() and

View File

@ -1,4 +1,4 @@
/* $Id: tif_dirread.c,v 1.167 2011-02-18 20:53:04 fwarmerdam Exp $ */
/* $Id: tif_dirread.c,v 1.168 2011-05-24 13:35:30 fwarmerdam Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -4575,6 +4575,12 @@ TIFFFetchDirectory(TIFF* tif, uint64 diroff, TIFFDirEntry** pdir,
dircount16 = (uint16)dircount64;
dirsize = 20;
}
if (dircount16 == 0 )
{
TIFFErrorExt(tif->tif_clientdata, module,
"Sanity check on directory count failed, zero tag directories not supported");
return 0;
}
origdir = _TIFFCheckMalloc(tif, dircount16,
dirsize,
"to read TIFF directory");