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

Merge branch 'PHP-8.3' into PHP-8.4

This commit is contained in:
David Carlier
2025-09-07 18:19:08 +01:00
3 changed files with 52 additions and 0 deletions

View File

@@ -837,6 +837,11 @@ PHP_FUNCTION(imagefilledellipse)
Z_PARAM_LONG(color)
ZEND_PARSE_PARAMETERS_END();
if (w < 0 || ZEND_LONG_INT_OVFL(w)) {
zend_argument_value_error(4, "must be between 0 and %d", INT_MAX);
RETURN_THROWS();
}
im = php_gd_libgdimageptr_from_zval_p(IM);
gdImageFilledEllipse(im, cx, cy, w, h, color);

27
ext/gd/tests/gh19578.phpt Normal file
View File

@@ -0,0 +1,27 @@
--TEST--
GH-19578: imagefilledellipse underflow on width argument
--EXTENSIONS--
gd
--SKIPIF--
<?php
if (PHP_INT_SIZE != 8) die('skip this test is for 64bit platforms only');
?>
--FILE--
<?php
$src = imagecreatetruecolor(255, 255);
try {
imagefilledellipse($src, 0, 0, PHP_INT_MAX, 254, 0);
} catch (\ValueError $e) {
echo $e->getMessage(), PHP_EOL;
}
try {
imagefilledellipse($src, 0, 0, -16, 254, 0);
} catch (\ValueError $e) {
echo $e->getMessage();
}
?>
--EXPECTF--
imagefilledellipse(): Argument #4 ($width) must be between 0 and %d
imagefilledellipse(): Argument #4 ($width) must be between 0 and %d

View File

@@ -0,0 +1,20 @@
--TEST--
GH-19578: imagefilledellipse underflow on width argument
--EXTENSIONS--
gd
--SKIPIF--
<?php
if (PHP_INT_SIZE != 4) die('skip this test is for 32bit platforms only');
?>
--FILE--
<?php
$src = imagecreatetruecolor(255, 255);
try {
imagefilledellipse($src, 0, 0, -16, 254, 0);
} catch (\ValueError $e) {
echo $e->getMessage();
}
?>
--EXPECTF--
imagefilledellipse(): Argument #4 ($width) must be between 0 and %d