mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-8.3'
This commit is contained in:
commit
0410bf4147
2 changed files with 16 additions and 0 deletions
|
@ -2996,6 +2996,10 @@ PHP_FUNCTION(range)
|
||||||
step = Z_LVAL_P(user_step);
|
step = Z_LVAL_P(user_step);
|
||||||
/* We only want positive step values. */
|
/* We only want positive step values. */
|
||||||
if (step < 0) {
|
if (step < 0) {
|
||||||
|
if (UNEXPECTED(step == ZEND_LONG_MIN)) {
|
||||||
|
zend_argument_value_error(3, "must be greater than " ZEND_LONG_FMT, step);
|
||||||
|
RETURN_THROWS();
|
||||||
|
}
|
||||||
is_step_negative = true;
|
is_step_negative = true;
|
||||||
step *= -1;
|
step *= -1;
|
||||||
}
|
}
|
||||||
|
|
12
ext/standard/tests/array/gh14775.phpt
Normal file
12
ext/standard/tests/array/gh14775.phpt
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
--TEST--
|
||||||
|
GH-14775: Range negative step overflow
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
$var = -PHP_INT_MAX - 1;
|
||||||
|
try {
|
||||||
|
range($var,1,$var);
|
||||||
|
} catch (\ValueError $e) {
|
||||||
|
echo $e->getMessage() . PHP_EOL;
|
||||||
|
}
|
||||||
|
--EXPECTF--
|
||||||
|
range(): Argument #3 ($step) must be greater than %s
|
Loading…
Add table
Add a link
Reference in a new issue