030fe340af
Add upstream post-4.0.7 commits (except for ChangeLog modifications) fixing the following security issues: CVE-2016-10266 - LibTIFF 4.0.7 allows remote attackers to cause a denial of service (divide-by-zero error and application crash) via a crafted TIFF image, related to libtiff/tif_read.c:351:22. CVE-2016-10267 - LibTIFF 4.0.7 allows remote attackers to cause a denial of service (divide-by-zero error and application crash) via a crafted TIFF image, related to libtiff/tif_ojpeg.c:816:8. CVE-2016-10269 - LibTIFF 4.0.7 allows remote attackers to cause a denial of service (heap-based buffer over-read) or possibly have unspecified other impact via a crafted TIFF image, related to "READ of size 512" and libtiff/tif_unix.c:340:2. CVE-2016-10270 - LibTIFF 4.0.7 allows remote attackers to cause a denial of service (heap-based buffer over-read) or possibly have unspecified other impact via a crafted TIFF image, related to "READ of size 8" and libtiff/tif_read.c:523:22. CVE-2017-5225 - LibTIFF version 4.0.7 is vulnerable to a heap buffer overflow in the tools/tiffcp resulting in DoS or code execution via a crafted BitsPerSample value. CVE-2017-7592 - The putagreytile function in tif_getimage.c in LibTIFF 4.0.7 has a left-shift undefined behavior issue, which might allow remote attackers to cause a denial of service (application crash) or possibly have unspecified other impact via a crafted image. CVE-2017-7593 - tif_read.c in LibTIFF 4.0.7 does not ensure that tif_rawdata is properly initialized, which might allow remote attackers to obtain sensitive information from process memory via a crafted image. CVE-2017-7594 - The OJPEGReadHeaderInfoSecTablesDcTable function in tif_ojpeg.c in LibTIFF 4.0.7 allows remote attackers to cause a denial of service (memory leak) via a crafted image. CVE-2017-7595 - The JPEGSetupEncode function in tiff_jpeg.c in LibTIFF 4.0.7 allows remote attackers to cause a denial of service (divide-by-zero error and application crash) via a crafted image. CVE-2017-7598 - tif_dirread.c in LibTIFF 4.0.7 might allow remote attackers to cause a denial of service (divide-by-zero error and application crash) via a crafted image. CVE-2017-7601 - LibTIFF 4.0.7 has a "shift exponent too large for 64-bit type long" undefined behavior issue, which might allow remote attackers to cause a denial of service (application crash) or possibly have unspecified other impact via a crafted image. CVE-2017-7602 - LibTIFF 4.0.7 has a signed integer overflow, which might allow remote attackers to cause a denial of service (application crash) or possibly have unspecified other impact via a crafted image. Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
48 lines
1.8 KiB
Diff
48 lines
1.8 KiB
Diff
From 3cfd62d77c2a7e147a05bd678524c345fa9c2bb8 Mon Sep 17 00:00:00 2001
|
|
From: erouault <erouault>
|
|
Date: Wed, 11 Jan 2017 13:28:01 +0000
|
|
Subject: [PATCH] * libtiff/tif_dirread.c: avoid division by floating point 0
|
|
in TIFFReadDirEntryCheckedRational() and TIFFReadDirEntryCheckedSrational(),
|
|
and return 0 in that case (instead of infinity as before presumably)
|
|
Apparently some sanitizers do not like those divisions by zero. Fixes
|
|
http://bugzilla.maptools.org/show_bug.cgi?id=2644
|
|
|
|
Fixes CVE-2017-7598
|
|
|
|
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
|
|
---
|
|
libtiff/tif_dirread.c | 10 ++++++++--
|
|
1 file changed, 16 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c
|
|
index 570d0c32..8a1e42aa 100644
|
|
--- a/libtiff/tif_dirread.c
|
|
+++ b/libtiff/tif_dirread.c
|
|
@@ -2872,7 +2872,10 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckedRational(TIFF* tif, TIFFD
|
|
m.l = direntry->tdir_offset.toff_long8;
|
|
if (tif->tif_flags&TIFF_SWAB)
|
|
TIFFSwabArrayOfLong(m.i,2);
|
|
- if (m.i[0]==0)
|
|
+ /* Not completely sure what we should do when m.i[1]==0, but some */
|
|
+ /* sanitizers do not like division by 0.0: */
|
|
+ /* http://bugzilla.maptools.org/show_bug.cgi?id=2644 */
|
|
+ if (m.i[0]==0 || m.i[1]==0)
|
|
*value=0.0;
|
|
else
|
|
*value=(double)m.i[0]/(double)m.i[1];
|
|
@@ -2900,7 +2903,10 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckedSrational(TIFF* tif, TIFF
|
|
m.l=direntry->tdir_offset.toff_long8;
|
|
if (tif->tif_flags&TIFF_SWAB)
|
|
TIFFSwabArrayOfLong(m.i,2);
|
|
- if ((int32)m.i[0]==0)
|
|
+ /* Not completely sure what we should do when m.i[1]==0, but some */
|
|
+ /* sanitizers do not like division by 0.0: */
|
|
+ /* http://bugzilla.maptools.org/show_bug.cgi?id=2644 */
|
|
+ if ((int32)m.i[0]==0 || m.i[1]==0)
|
|
*value=0.0;
|
|
else
|
|
*value=(double)((int32)m.i[0])/(double)m.i[1];
|
|
--
|
|
2.11.0
|
|
|