summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerouault <erouault>2017-02-18 20:30:26 +0000
committererouault <erouault>2017-02-18 20:30:26 +0000
commit340153b9b9234317e7693a23ad67b6b395af2a59 (patch)
tree326ee361e8c9c37b118eac5d4950ee6ee0731062
parentfc6714e0c6bb22bbbd517a930106000572833e45 (diff)
downloadlibtiff-340153b9b9234317e7693a23ad67b6b395af2a59.tar.gz
* libtiff/tif_pixarlog.c: fix memory leak in error code path of
PixarLogSetupDecode(). Patch by Nicolás Peña. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2665
-rw-r--r--ChangeLog6
-rw-r--r--libtiff/tif_pixarlog.c8
2 files changed, 13 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index bbf3d5f7..cc84fdae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2017-02-18 Even Rouault <even.rouault at spatialys.com>
+ * libtiff/tif_pixarlog.c: fix memory leak in error code path of
+ PixarLogSetupDecode(). Patch by Nicolás Peña.
+ Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2665
+
+2017-02-18 Even Rouault <even.rouault at spatialys.com>
+
* libtiff/tif_lzw.c: in LZWPostEncode(), increase, if necessary, the
code bit-width after flushing the remaining code and before emitting
the EOI code.
diff --git a/libtiff/tif_pixarlog.c b/libtiff/tif_pixarlog.c
index 9836dce6..972ee75e 100644
--- a/libtiff/tif_pixarlog.c
+++ b/libtiff/tif_pixarlog.c
@@ -1,4 +1,4 @@
-/* $Id: tif_pixarlog.c,v 1.49 2016-12-02 23:05:51 erouault Exp $ */
+/* $Id: tif_pixarlog.c,v 1.50 2017-02-18 20:30:26 erouault Exp $ */
/*
* Copyright (c) 1996-1997 Sam Leffler
@@ -699,6 +699,9 @@ PixarLogSetupDecode(TIFF* tif)
if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN)
sp->user_datafmt = PixarLogGuessDataFmt(td);
if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN) {
+ _TIFFfree(sp->tbuf);
+ sp->tbuf = NULL;
+ sp->tbuf_size = 0;
TIFFErrorExt(tif->tif_clientdata, module,
"PixarLog compression can't handle bits depth/data format combination (depth: %d)",
td->td_bitspersample);
@@ -706,6 +709,9 @@ PixarLogSetupDecode(TIFF* tif)
}
if (inflateInit(&sp->stream) != Z_OK) {
+ _TIFFfree(sp->tbuf);
+ sp->tbuf = NULL;
+ sp->tbuf_size = 0;
TIFFErrorExt(tif->tif_clientdata, module, "%s", sp->stream.msg ? sp->stream.msg : "(null)");
return (0);
} else {