summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/libtiff-CVE-2016-9448.patch
blob: 05a3af8a840846d4227a48722104cf6af1138e60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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';