1
0
mirror of https://github.com/php/php-src.git synced 2026-03-26 01:02:25 +01:00

Fix bug #72730 - imagegammacorrect allows arbitrary write access

This commit is contained in:
Stanislav Malyshev
2016-08-10 00:14:58 -07:00
parent a3598dd7c9
commit 1bd103df00
2 changed files with 20 additions and 0 deletions

View File

@@ -3082,6 +3082,11 @@ PHP_FUNCTION(imagegammacorrect)
return;
}
if ( input <= 0.0 || output <= 0.0 ) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Gamma values should be positive");
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, "Image", le_gd);
if (gdImageTrueColor(im)) {

View File

@@ -0,0 +1,15 @@
--TEST--
Bug #72730: imagegammacorrect allows arbitrary write access
--SKIPIF--
<?php
if (!function_exists("imagecreatetruecolor")) die("skip");
?>
--FILE--
<?php
$img = imagecreatetruecolor(1, 1);
imagegammacorrect($img, -1, 1337);
?>
DONE
--EXPECTF--
Warning: imagegammacorrect(): Gamma values should be positive in %sbug72730.php on line %d
DONE