]> granicus.if.org Git - php/commitdiff
- #33220, fix infinite loop while loading invalid gif, this patch fixes
authorPierre Joye <pajoye@php.net>
Sat, 24 Sep 2005 14:37:49 +0000 (14:37 +0000)
committerPierre Joye <pajoye@php.net>
Sat, 24 Sep 2005 14:37:49 +0000 (14:37 +0000)
  at least many cases (nlopess)

ext/gd/libgd/gd_gif_in.c

index 73f5e49c2ddd376910aa7a5ab81638fe43bd4952..1733a646f36f91f12ba616fb0eeb2b346fc89b13 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;