com php-src: Fix bug #68601 buffer read overflow in gd_gif_in.c: NEWS ext/gd/libgd/gd_gif_in.c

From: Date: Mon, 06 Apr 2015 00:33:52 +0000
Subject: com php-src: Fix bug #68601 buffer read overflow in gd_gif_in.c: NEWS ext/gd/libgd/gd_gif_in.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-86090@lists.php.net to get a copy of this message
Commit: afbf725e7380dfb3ff43a993e43abd9759a66c2b Author: Remi Collet <remi@php.net> Sat, 13 Dec 2014 09:03:44 +0100 Committer: Stanislav Malyshev <stas@php.net> Sun, 5 Apr 2015 17:33:52 -0700 Parents: caecd88237f260c78428feb0acc6578618fa231b Branches: PHP-5.4 PHP-5.5 PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=afbf725e7380dfb3ff43a993e43abd9759a66c2b Log: Fix bug #68601 buffer read overflow in gd_gif_in.c Bugs: https://bugs.php.net/68601 Changed paths: M NEWS M ext/gd/libgd/gd_gif_in.c Diff: diff --git a/NEWS b/NEWS index 3656154..7596b00 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2015 PHP 5.4.40 +- GD: + . Fixed bug #68601 (buffer read overflow in gd_gif_in.c).. (Remi) + - SOAP: . Fixed bug #69152 (Type Confusion Infoleak Vulnerability in unserialize() with SoapFault). (Dmitry) diff --git a/ext/gd/libgd/gd_gif_in.c b/ext/gd/libgd/gd_gif_in.c index ee88a2f..491e942 100644 --- a/ext/gd/libgd/gd_gif_in.c +++ b/ext/gd/libgd/gd_gif_in.c @@ -72,8 +72,10 @@ static struct { #define STACK_SIZE ((1<<(MAX_LWZ_BITS))*2) +#define CSD_BUF_SIZE 280 + typedef struct { - unsigned char buf[280]; + unsigned char buf[CSD_BUF_SIZE]; int curbit, lastbit, done, last_byte; } CODE_STATIC_DATA; @@ -400,7 +402,12 @@ GetCode_(gdIOCtx *fd, CODE_STATIC_DATA *scd, int code_size, int flag, int *ZeroD ret = 0; for (i = scd->curbit, j = 0; j < code_size; ++i, ++j) - ret |= ((scd->buf[ i / 8 ] & (1 << (i % 8))) != 0) << j; + if (i < CSD_BUF_SIZE * 8) { + ret |= ((scd->buf[i / 8] & (1 << (i % 8))) != 0) << j; + } else { + ret = -1; + break; + } scd->curbit += code_size; return ret;

« previous php.cvs (#86090) next »