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

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