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

From: Date: Tue, 05 Jan 2016 12:33:50 +0000
Subject: com php-src: Fix bug #70976: fix boundary check on gdImageRotateInterpolated: ext/gd/libgd/gd_interpolation.c ext/gd/tests/bug70976.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-90545@lists.php.net to get a copy of this message
Commit: 4b8394dd78571826ac66a69dc240c623f31d78f8 Author: Stanislav Malyshev <stas@php.net> Mon, 7 Dec 2015 23:30:49 -0800 Committer: Anatol Belski <ab@php.net> Tue, 5 Jan 2016 13:33:50 +0100 Parents: 2721a0148649e07ed74468f097a28899741eb58f Branches: PHP-7.0.2 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4b8394dd78571826ac66a69dc240c623f31d78f8 Log: Fix bug #70976: fix boundary check on gdImageRotateInterpolated Bugs: https://bugs.php.net/70976 Changed paths: M ext/gd/libgd/gd_interpolation.c A ext/gd/tests/bug70976.phpt Diff: diff --git a/ext/gd/libgd/gd_interpolation.c b/ext/gd/libgd/gd_interpolation.c index f70169d..0f874ac 100644 --- a/ext/gd/libgd/gd_interpolation.c +++ b/ext/gd/libgd/gd_interpolation.c @@ -2162,7 +2162,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 (#90545) next »