Fix bug #72730 - imagegammacorrect allows arbitrary write access

This commit is contained in:
Stanislav Malyshev committed 2016-08-16 22:55:40 -07:00
1 parent a3598dd7c9
commit 1bd103df00
2 files changed
+20

No files matched your search

+5
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)) {
+15
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