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:
@@ -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
ext/gd/tests/bug72730.phpt
Normal file
15
ext/gd/tests/bug72730.phpt
Normal 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
|
||||
Reference in New Issue
Block a user