From f8a3650a7c5552b51101a375401ce0db57dedf3f Mon Sep 17 00:00:00 2001 From: Frank Warmerdam Date: Tue, 24 May 2011 13:35:30 +0000 Subject: [PATCH] improve error report with zero tag directories --- ChangeLog | 5 +++++ libtiff/tif_dirread.c | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 85c5b4bc..49d2a41f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-05-24 Frank Warmerdam + + * 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 * libtiff/tif_dirinfo.c: Restore TIFFMergeFieldInfo() and diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c index 6f96ec04..6296a1d3 100644 --- a/libtiff/tif_dirread.c +++ b/libtiff/tif_dirread.c @@ -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");