From 2fedcd1895fa8c2c378091de278815050fe79d55 Mon Sep 17 00:00:00 2001 From: Leo Famulari Date: Sat, 19 Nov 2016 11:12:34 -0500 Subject: [PATCH] gnu: libtiff: Fix CVE-2016-9448. * gnu/packages/patches/libtiff-CVE-2016-9448.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/image.scm (libtiff/fixed)[source]: Use it. --- gnu/local.mk | 1 + gnu/packages/image.scm | 3 +- .../patches/libtiff-CVE-2016-9448.patch | 34 +++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/libtiff-CVE-2016-9448.patch diff --git a/gnu/local.mk b/gnu/local.mk index 17bfda2a77..7112451586 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -671,6 +671,7 @@ dist_patch_DATA = \ %D%/packages/patches/libtiff-CVE-2016-5652.patch \ %D%/packages/patches/libtiff-CVE-2016-9273.patch \ %D%/packages/patches/libtiff-CVE-2016-9297.patch \ + %D%/packages/patches/libtiff-CVE-2016-9448.patch \ %D%/packages/patches/libtiff-oob-accesses-in-decode.patch \ %D%/packages/patches/libtiff-oob-write-in-nextdecode.patch \ %D%/packages/patches/libtiff-uint32-overflow.patch \ diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm index 8f08fad153..309c336779 100644 --- a/gnu/packages/image.scm +++ b/gnu/packages/image.scm @@ -302,7 +302,8 @@ collection of tools for doing simple manipulations of TIFF images.") "libtiff-CVE-2016-5323.patch" "libtiff-CVE-2016-5652.patch" "libtiff-CVE-2016-9273.patch" - "libtiff-CVE-2016-9297.patch")))))) + "libtiff-CVE-2016-9297.patch" + "libtiff-CVE-2016-9448.patch")))))) (define-public libwmf (package diff --git a/gnu/packages/patches/libtiff-CVE-2016-9448.patch b/gnu/packages/patches/libtiff-CVE-2016-9448.patch new file mode 100644 index 0000000000..05a3af8a84 --- /dev/null +++ b/gnu/packages/patches/libtiff-CVE-2016-9448.patch @@ -0,0 +1,34 @@ +Fix CVE-2016-9448 (regression caused by fix for CVE-2016-9297). + +http://bugzilla.maptools.org/show_bug.cgi?id=2593 +https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-9448 + +Patch copied from upstream source repository with: +$ cvs diff -u -r 1.203 -r 1.204 libtiff/libtiff/tif_dirread.c + +Index: libtiff/libtiff/tif_dirread.c +=================================================================== +RCS file: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dirread.c,v +retrieving revision 1.203 +retrieving revision 1.204 +diff -u -r1.203 -r1.204 +--- libtiff/libtiff/tif_dirread.c 11 Nov 2016 20:22:01 -0000 1.203 ++++ libtiff/libtiff/tif_dirread.c 16 Nov 2016 15:14:15 -0000 1.204 +@@ -5000,7 +5000,7 @@ + if (err==TIFFReadDirEntryErrOk) + { + int m; +- if( data[dp->tdir_count-1] != '\0' ) ++ if( dp->tdir_count > 0 && data[dp->tdir_count-1] != '\0' ) + { + TIFFWarningExt(tif->tif_clientdata,module,"ASCII value for tag \"%s\" does not end in null byte. Forcing it to be null",fip->field_name); + data[dp->tdir_count-1] = '\0'; +@@ -5177,7 +5177,7 @@ + if (err==TIFFReadDirEntryErrOk) + { + int m; +- if( data[dp->tdir_count-1] != '\0' ) ++ if( dp->tdir_count > 0 && data[dp->tdir_count-1] != '\0' ) + { + TIFFWarningExt(tif->tif_clientdata,module,"ASCII value for tag \"%s\" does not end in null byte. Forcing it to be null",fip->field_name); + data[dp->tdir_count-1] = '\0';