aboutsummaryrefslogtreecommitdiffstats
path: root/main/tiff/CVE-2017-7595.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/tiff/CVE-2017-7595.patch')
-rw-r--r--main/tiff/CVE-2017-7595.patch29
1 files changed, 29 insertions, 0 deletions
diff --git a/main/tiff/CVE-2017-7595.patch b/main/tiff/CVE-2017-7595.patch
new file mode 100644
index 0000000000..6b27b7c9a3
--- /dev/null
+++ b/main/tiff/CVE-2017-7595.patch
@@ -0,0 +1,29 @@
+From 47f2fb61a3a64667bce1a8398a8fcb1b348ff122 Mon Sep 17 00:00:00 2001
+From: erouault <erouault>
+Date: Wed, 11 Jan 2017 12:15:01 +0000
+Subject: [PATCH] * libtiff/tif_jpeg.c: avoid integer division by zero in
+ JPEGSetupEncode() when horizontal or vertical sampling is set to 0. Fixes
+ http://bugzilla.maptools.org/show_bug.cgi?id=2653
+
+---
+ libtiff/tif_jpeg.c | 7 +++++++
+ 2 files changed, 13 insertions(+)
+
+diff --git a/libtiff/tif_jpeg.c b/libtiff/tif_jpeg.c
+index 38595f9..6c17c38 100644
+--- a/libtiff/tif_jpeg.c
++++ b/libtiff/tif_jpeg.c
+@@ -1626,6 +1626,13 @@ JPEGSetupEncode(TIFF* tif)
+ case PHOTOMETRIC_YCBCR:
+ sp->h_sampling = td->td_ycbcrsubsampling[0];
+ sp->v_sampling = td->td_ycbcrsubsampling[1];
++ if( sp->h_sampling == 0 || sp->v_sampling == 0 )
++ {
++ TIFFErrorExt(tif->tif_clientdata, module,
++ "Invalig horizontal/vertical sampling value");
++ return (0);
++ }
++
+ /*
+ * A ReferenceBlackWhite field *must* be present since the
+ * default value is inappropriate for YCbCr. Fill in the