com php-src: Fix bug #70976: fix boundary check on gdImageRotateInterpolated: NEWS ext/gd/libgd/gd_interpolation .c ext/gd/tests/bug70976.phpt

From: Date: Tue, 08 Dec 2015 07:33:05 +0000
Subject: com php-src: Fix bug #70976: fix boundary check on gdImageRotateInterpolated: NEWS ext/gd/libgd/gd_interpolation .c ext/gd/tests/bug70976.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-90528@lists.php.net to get a copy of this message
Commit: 4bb422343f29f06b7081323844d9b52e1a71e4a5 Author: Stanislav Malyshev <stas@php.net> Mon, 7 Dec 2015 23:30:49 -0800 Parents: 2e157c527508c3cfa85bdabffe0560f2e50abf18 Branches: PHP-5.5 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4bb422343f29f06b7081323844d9b52e1a71e4a5 Log: Fix bug #70976: fix boundary check on gdImageRotateInterpolated Bugs: https://bugs.php.net/70976 Changed paths: M NEWS M ext/gd/libgd/gd_interpolation.c A ext/gd/tests/bug70976.phpt Diff: diff --git a/NEWS b/NEWS index d2a2f95..d9fcf14 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,10 @@ PHP NEWS ?? ??? 2015, PHP 5.5.31 +- GD: + . Fixed bug #70976 (Memory Read via gdImageRotateInterpolated Array Index + Out of Bounds). (emmanuel dot law at gmail dot com). + 01 Oct 2015, PHP 5.5.30 - Phar: diff --git a/ext/gd/libgd/gd_interpolation.c b/ext/gd/libgd/gd_interpolation.c index 65e2360..efb584c 100644 --- a/ext/gd/libgd/gd_interpolation.c +++ b/ext/gd/libgd/gd_interpolation.c @@ -2154,7 +2154,7 @@ gdImagePtr gdImageRotateInterpolated(const gdImagePtr src, const float angle, in { const int angle_rounded = (int)floor(angle * 100); - if (bgcolor < 0) { + if (bgcolor < 0 || bgcolor >= gdMaxColors) { return NULL; } diff --git a/ext/gd/tests/bug70976.phpt b/ext/gd/tests/bug70976.phpt new file mode 100644 index 0000000..23af4ee --- /dev/null +++ b/ext/gd/tests/bug70976.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #70976 (Memory Read via gdImageRotateInterpolated Array Index Out of Bounds) +--SKIPIF-- +<?php + if(!extension_loaded('gd')){ die('skip gd extension not available'); } +?> +--FILE-- +<?php +$img = imagerotate(imagecreate(1,1),45,0x7ffffff9); +var_dump($img); +?> +--EXPECTF-- +bool(false) \ No newline at end of file

« previous php.cvs (#90528) next »