]> granicus.if.org Git - php/commitdiff
- MFH #33220, infinite loop while loading invalid GIF (nlopees)
authorPierre Joye <pajoye@php.net>
Sun, 25 Sep 2005 12:13:49 +0000 (12:13 +0000)
committerPierre Joye <pajoye@php.net>
Sun, 25 Sep 2005 12:13:49 +0000 (12:13 +0000)
 NB: It's getting really annoying to apply patches to all these branches
     Can we no define 4.x and 5.0.x as dead for 99.99% of the fixes?

ext/gd/libgd/gd_gif_in.c

index a5cd6644617f16b2949a42593b4803527447da0a..e8817d77209fa99edfbb64d08ffab283381a67f2 100644 (file)
@@ -259,13 +259,13 @@ DoExtension(gdIOCtx *fd, int label, int *Transparent)
                if ((buf[0] & 0x1) != 0)
                        *Transparent = buf[3];
 
-               while (GetDataBlock(fd, (unsigned char*) buf) != 0)
+               while (GetDataBlock(fd, (unsigned char*) buf) > 0)
                        ;
                return FALSE;
        default:
                break;
        }
-       while (GetDataBlock(fd, (unsigned char*) buf) != 0)
+       while (GetDataBlock(fd, (unsigned char*) buf) > 0)
                ;
 
        return FALSE;
@@ -337,7 +337,7 @@ GetCode_(gdIOCtx *fd, int code_size, int flag)
                buf[0] = buf[last_byte-2];
                buf[1] = buf[last_byte-1];
 
-               if ((count = GetDataBlock(fd, &buf[2])) == 0)
+               if ((count = GetDataBlock(fd, &buf[2])) <= 0)
                        done = TRUE;
 
                last_byte = 2 + count;