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

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