diff options
author | Even Rouault <even.rouault@spatialys.com> | 2017-04-27 19:50:01 +0000 |
---|---|---|
committer | Even Rouault <even.rouault@spatialys.com> | 2017-04-27 19:50:01 +0000 |
commit | fa557773701a0d9750aeeb0284a04dc4d418e755 (patch) | |
tree | a877dbca0acac5b776f8e58b8c4ce817513354f1 /tools/fax2tiff.c | |
parent | bb30ee4f093c5ca4b45539becb752bfa67feea0f (diff) | |
download | libtiff-git-fa557773701a0d9750aeeb0284a04dc4d418e755.tar.gz |
* litiff/tif_fax3.c: avoid crash in Fax3Close() on empty file.
Patch by Alan Coopersmith + complement by myself.
Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2673
* tools/fax2tiff.c: emit appropriate message if the input file is
empty. Patch by Alan Coopersmith.
Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2672
Diffstat (limited to 'tools/fax2tiff.c')
-rw-r--r-- | tools/fax2tiff.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/fax2tiff.c b/tools/fax2tiff.c index 01f85540..d43c2dca 100644 --- a/tools/fax2tiff.c +++ b/tools/fax2tiff.c @@ -1,4 +1,4 @@ -/* $Id: fax2tiff.c,v 1.26 2016-11-20 18:04:52 bfriesen Exp $ */ +/* $Id: fax2tiff.c,v 1.27 2017-04-27 19:50:01 erouault Exp $ */ /* * Copyright (c) 1990-1997 Sam Leffler @@ -371,6 +371,10 @@ copyFaxFile(TIFF* tifin, TIFF* tifout) int ok; tifin->tif_rawdatasize = (tmsize_t)TIFFGetFileSize(tifin); + if (tifin->tif_rawdatasize == 0) { + TIFFError(tifin->tif_name, "Empty input file"); + return (0); + } tifin->tif_rawdata = _TIFFmalloc(tifin->tif_rawdatasize); if (tifin->tif_rawdata == NULL) { TIFFError(tifin->tif_name, "Not enough memory"); |