summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorerouault <erouault>2017-04-27 19:50:01 +0000
committererouault <erouault>2017-04-27 19:50:01 +0000
commitce502b8863e5ae916e591a6212279966d9563bce (patch)
treec6004625cf0f708f66b54a13a74942ec75a4609c /tools
parentcf9d7dabaaf759ab71f4449fb8bb25d62172e944 (diff)
downloadlibtiff-ce502b8863e5ae916e591a6212279966d9563bce.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')
-rw-r--r--tools/fax2tiff.c6
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");