com php-src: Fix #72696: imagefilltoborder stackoverflow on truecolor images: ext/gd/libgd/gd.c ext/gd/tests/bug72696.phpt

From: Date: Sun, 30 Oct 2016 21:31:29 +0000
Subject: com php-src: Fix #72696: imagefilltoborder stackoverflow on truecolor images: ext/gd/libgd/gd.c ext/gd/tests/bug72696.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-95430@lists.php.net to get a copy of this message
Commit: 863d37ea66d5c960db08d6f4a2cbd2518f0f80d1 Author: Christoph M. Becker <cmbecker69@gmx.de> Tue, 25 Oct 2016 13:23:16 +0200 Committer: Stanislav Malyshev <stas@php.net> Sun, 30 Oct 2016 14:31:29 -0700 Parents: 6499581af76cfe986e12330faabb3a7c36d45ffc Branches: PHP-5.6 PHP-7.0 PHP-7.1 master Link: http://git.php.net/?p=php-src..git;a=commitdiff;h=863d37ea66d5c960db08d6f4a2cbd2518f0f80d1 Log: Fix #72696: imagefilltoborder stackoverflow on truecolor images We must not allow negative color values be passed to gdImageFillToBorder(), because that can lead to infinite recursion since the recursion termination condition will not necessarily be met. Bugs: https://bugs.php.net/72696 Changed paths: M ext/gd/libgd/gd.c A ext/gd/tests/bug72696.phpt Diff: diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd..c index 058f1c9..3e7d27a 100644 --- a/ext/gd/libgd/gd.c +++ b/ext/gd/libgd/gd.c @@ -1747,7 +1747,7 @@ void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color) int leftLimit = -1, rightLimit; int i, restoreAlphaBlending = 0; - if (border < 0) { + if (border < 0 || color < 0) { /* Refuse to fill to a non-solid border */ return; } diff --git a/ext/gd/tests/bug72696.phpt b/ext/gd/tests/bug72696.phpt new file mode 100644 index 0000000..4f0d9e7 --- /dev/null +++ b/ext/gd/tests/bug72696.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #72696 (imagefilltoborder stackoverflow on truecolor images) +--SKIPIF-- +<?php +if (!extension_loaded('gd')) die('skip gd extension not available'); +?> +--FILE-- +<?php +$im = imagecreatetruecolor(10, 10); +imagefilltoborder($im, 0, 0, 1, -2); +?> +===DONE=== +--EXPECT-- +===DONE===

« previous php.cvs (#95430) next »