From 13704be6d172eef2459bb3a5ceed47711ef08b99 Mon Sep 17 00:00:00 2001 From: Rajkumar Veer Date: Fri, 3 Nov 2017 22:30:13 -0700 Subject: tiff: Security fix for CVE-2017-7598 Signed-off-by: Rajkumar Veer Signed-off-by: Armin Kuster --- .../libtiff/files/CVE-2017-7598.patch | 65 ++++++++++++++++++++++ meta/recipes-multimedia/libtiff/tiff_4.0.7.bb | 1 + 2 files changed, 66 insertions(+) create mode 100644 meta/recipes-multimedia/libtiff/files/CVE-2017-7598.patch diff --git a/meta/recipes-multimedia/libtiff/files/CVE-2017-7598.patch b/meta/recipes-multimedia/libtiff/files/CVE-2017-7598.patch new file mode 100644 index 0000000000..6d082bb613 --- /dev/null +++ b/meta/recipes-multimedia/libtiff/files/CVE-2017-7598.patch @@ -0,0 +1,65 @@ +From 3cfd62d77c2a7e147a05bd678524c345fa9c2bb8 Mon Sep 17 00:00:00 2001 +From: 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 + +Upstream-Status: Backport + +CVE: CVE-2017-7598 +Signed-off-by: Rajkumar Veer +Index: tiff-4.0.7/ChangeLog +=================================================================== +--- tiff-4.0.7.orig/ChangeLog 2017-04-25 16:14:59.858612730 +0530 ++++ tiff-4.0.7/ChangeLog 2017-04-25 18:11:36.048107127 +0530 +@@ -1,3 +1,4 @@ ++ + 2017-01-12 Even Rouault + + * libtiff/tif_ojpeg.c: fix leak in OJPEGReadHeaderInfoSecTablesQTable, +@@ -8,6 +9,14 @@ + + 2017-01-11 Even Rouault + ++ * 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 ++ ++2017-01-11 Even Rouault ++ + * libtiff/tif_dir.c, tif_dirread.c, tif_dirwrite.c: implement various clampings + of double to other data types to avoid undefined behaviour if the output range + isn't big enough to hold the input value. +Index: tiff-4.0.7/libtiff/tif_dirread.c +=================================================================== +--- tiff-4.0.7.orig/libtiff/tif_dirread.c 2017-04-25 16:14:59.858612730 +0530 ++++ tiff-4.0.7/libtiff/tif_dirread.c 2017-04-25 18:16:21.836111576 +0530 +@@ -2880,7 +2880,10 @@ + 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]; +@@ -2908,7 +2911,10 @@ + 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]; diff --git a/meta/recipes-multimedia/libtiff/tiff_4.0.7.bb b/meta/recipes-multimedia/libtiff/tiff_4.0.7.bb index 77de0be1e7..73deeba687 100644 --- a/meta/recipes-multimedia/libtiff/tiff_4.0.7.bb +++ b/meta/recipes-multimedia/libtiff/tiff_4.0.7.bb @@ -23,6 +23,7 @@ SRC_URI = "http://download.osgeo.org/libtiff/tiff-${PV}.tar.gz \ file://CVE-2017-7594-p2.patch \ file://CVE-2017-7595.patch \ file://CVE-2017-7596.patch \ + file://CVE-2017-7598.patch \ " SRC_URI[md5sum] = "77ae928d2c6b7fb46a21c3a29325157b" -- cgit 1.2.3-korg