Blame SOURCES/gd-loop.patch

afb210
diff -up gd-2.0.35/gd_gif_in.c.loop gd-2.0.35/gd_gif_in.c
afb210
--- gd-2.0.35/gd_gif_in.c.loop	2007-06-14 15:51:41.000000000 -0400
afb210
+++ gd-2.0.35/gd_gif_in.c	2008-07-21 11:20:25.000000000 -0400
afb210
@@ -453,16 +453,17 @@ LWZReadByte_(gdIOCtx *fd, LZW_STATIC_DAT
afb210
                        return sd->firstcode;
afb210
                } else if (code == sd->end_code) {
afb210
                        int             count;
afb210
+                       int             max_count = 1024;
afb210
                        unsigned char   buf[260];
afb210
 
afb210
                        if (*ZeroDataBlockP)
afb210
                                return -2;
afb210
 
afb210
-                       while ((count = GetDataBlock(fd, buf, ZeroDataBlockP)) > 0)
afb210
+                       while ((count = GetDataBlock(fd, buf, ZeroDataBlockP)) > 0 && --max_count >= 0 )
afb210
                                ;
afb210
 
afb210
-                       if (count != 0)
afb210
-                       return -2;
afb210
+                       if (count != 0 || max_count < 0 )
afb210
+                               return -2;
afb210
                }
afb210
 
afb210
                incode = code;