Blame SOURCES/libtiff-CVE-2013-4243.patch

0e6869
diff --git a/tools/gif2tiff.c b/tools/gif2tiff.c
0e6869
index 2786974..9262573 100644
0e6869
--- a/tools/gif2tiff.c
0e6869
+++ b/tools/gif2tiff.c
0e6869
@@ -276,6 +276,10 @@ readgifimage(char* mode)
0e6869
         fprintf(stderr, "no colormap present for image\n");
0e6869
         return (0);
0e6869
     }
0e6869
+    if (width == 0 || height == 0) {
0e6869
+        fprintf(stderr, "Invalid value of width or height\n");
0e6869
+        return(0);
0e6869
+    }
0e6869
     if ((raster = (unsigned char*) _TIFFmalloc(width*height+EXTRAFUDGE)) == NULL) {
0e6869
         fprintf(stderr, "not enough memory for image\n");
0e6869
         return (0);
0e6869
@@ -402,6 +406,10 @@ process(register int code, unsigned char** fill)
0e6869
             fprintf(stderr, "bad input: code=%d is larger than clear=%d\n",code, clear);
0e6869
             return 0;
0e6869
         }
0e6869
+        if (*fill >= raster + width*height) {
0e6869
+            fprintf(stderr, "raster full before eoi code\n");
0e6869
+            return 0;
0e6869
+        }
0e6869
 	*(*fill)++ = suffix[code];
0e6869
 	firstchar = oldcode = code;
0e6869
 	return 1;
0e6869
@@ -432,6 +440,10 @@ process(register int code, unsigned char** fill)
0e6869
     }
0e6869
     oldcode = incode;
0e6869
     do {
0e6869
+        if (*fill >= raster + width*height) {
0e6869
+            fprintf(stderr, "raster full before eoi code\n");
0e6869
+            return 0;
0e6869
+        }
0e6869
 	*(*fill)++ = *--stackp;
0e6869
     } while (stackp > stack);
0e6869
     return 1;