summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerouault <erouault>2017-07-15 11:13:46 +0000
committererouault <erouault>2017-07-15 11:13:46 +0000
commite254e3d7a2a9a475fa490e108ca194405d0f1ed1 (patch)
tree8eb7c6f38d1e357b086a28bb53c045bf1b71cdde
parentc907c9aaaf37b171245e759cf69023ad911864ef (diff)
downloadlibtiff-e254e3d7a2a9a475fa490e108ca194405d0f1ed1.tar.gz
* tools/tiff2pdf.c: prevent heap buffer overflow write in "Raw"
mode on PlanarConfig=Contig input images. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2715 Reported by team OWL337
-rw-r--r--ChangeLog7
-rw-r--r--tools/tiff2pdf.c9
2 files changed, 14 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index b4771234..1b5490f3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2017-07-15 Even Rouault <even.rouault at spatialys.com>
+
+ * tools/tiff2pdf.c: prevent heap buffer overflow write in "Raw"
+ mode on PlanarConfig=Contig input images.
+ Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2715
+ Reported by team OWL337
+
2017-07-11 Even Rouault <even.rouault at spatialys.com>
* libtiff/tif_dir.c: avoid potential null pointer dereference in
diff --git a/tools/tiff2pdf.c b/tools/tiff2pdf.c
index 8e4e24ef..caf64ee5 100644
--- a/tools/tiff2pdf.c
+++ b/tools/tiff2pdf.c
@@ -1,4 +1,4 @@
-/* $Id: tiff2pdf.c,v 1.101 2016-12-20 17:28:17 erouault Exp $
+/* $Id: tiff2pdf.c,v 1.102 2017-07-15 11:13:46 erouault Exp $
*
* tiff2pdf - converts a TIFF image to a PDF document
*
@@ -1737,7 +1737,12 @@ void t2p_read_tiff_data(T2P* t2p, TIFF* input){
return;
t2p->pdf_transcode = T2P_TRANSCODE_ENCODE;
- if(t2p->pdf_nopassthrough==0){
+ /* It seems that T2P_TRANSCODE_RAW mode doesn't support separate->contig */
+ /* conversion. At least t2p_read_tiff_size and t2p_read_tiff_size_tile */
+ /* do not take into account the number of samples, and thus */
+ /* that can cause heap buffer overflows such as in */
+ /* http://bugzilla.maptools.org/show_bug.cgi?id=2715 */
+ if(t2p->pdf_nopassthrough==0 && t2p->tiff_planar!=PLANARCONFIG_SEPARATE){
#ifdef CCITT_SUPPORT
if(t2p->tiff_compression==COMPRESSION_CCITTFAX4
){