com php-src: Fix #73003: Integer Overflow in gdImageWebpCtx of gd_webp.c: NEWS ext/gd/libgd/gd_webp.c

From: Date: Fri, 16 Sep 2016 09:37:18 +0000
Subject: com php-src: Fix #73003: Integer Overflow in gdImageWebpCtx of gd_webp.c: NEWS ext/gd/libgd/gd_webp.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-94563@lists.php.net to get a copy of this message
Commit: 46df0642618eabc5b5b7df490d1ae23bda00a745 Author: Christoph M. Becker <cmbecker69@gmx.de> Fri, 16 Sep 2016 11:31:21 +0200 Parents: 3c117d4136d26c8d6e4127c89b2160c477f45e11 Branches: PHP-5.6 PHP-7..0 PHP-7.1 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=46df0642618eabc5b5b7df490d1ae23bda00a745 Log: Fix #73003: Integer Overflow in gdImageWebpCtx of gd_webp.c We add the missing integer overflow check to avoid potential buffer overflows. Bugs: https://bugs.php.net/73003 Changed paths: M NEWS M ext/gd/libgd/gd_webp.c Diff: diff --git a/NEWS b/NEWS index 63a6800..ef6cb57 100644 --- a/NEWS +++ b/NEWS @@ -22,6 +22,8 @@ PHP NEWS (cmb) . Fixed bug #50194 (imagettftext broken on transparent background w/o alphablending). (cmb) + . Fixed bug #73003 (Integer Overflow in gdImageWebpCtx of gd_webp.c). (trylab, + cmb) - Mbstring: .. Fixed bug #72994 (mbc_to_code() out of bounds read). (Laruence, cmb) diff --git a/ext/gd/libgd/gd_webp.c b/ext/gd/libgd/gd_webp.c index bf9ac9d...985187e 100644 --- a/ext/gd/libgd/gd_webp.c +++ b/ext/gd/libgd/gd_webp..c @@ -180,6 +180,15 @@ void gdImageWebpCtx (gdImagePtr im, gdIOCtx * outfile, int quantization) /* Conversion to Y,U,V buffer */ yuv_width = (width + 1) >> 1; yuv_height = (height + 1) >> 1; + + if (overflow2(width, height)) { + return; + } + /* simplification possible, because WebP must not be larger than 16384**2 */ + if (overflow2(width * height, 2 * sizeof(unsigned char))) { + return; + } + yuv_nbytes = width * height + 2 * yuv_width * yuv_height; if ((Y = (unsigned char *)gdCalloc(yuv_nbytes, sizeof(unsigned char))) == NULL) {

« previous php.cvs (#94563) next »