Blob Blame History Raw
--- gd-2.0.33/gd_gif_in.c.loop	2004-11-01 19:28:56.000000000 +0100
+++ gd-2.0.33/gd_gif_in.c	2006-07-10 14:59:42.000000000 +0200
@@ -418,16 +418,17 @@
                        return firstcode;
                } else if (code == end_code) {
                        int             count;
+					   int max_count = 1024;
                        unsigned char   buf[260];
 
                        if (*ZeroDataBlockP)
                                return -2;
 
-                       while ((count = GetDataBlock(fd, buf, ZeroDataBlockP)) > 0)
+                       while ((count = GetDataBlock(fd, buf, ZeroDataBlockP)) > 0 && --max_count >= 0 )
                                ;
 
-                       if (count != 0)
-                       return -2;
+                       if (count != 0 || max_count < 0 )
+						 return -2;
                }
 
                incode = code;