mirror of
https://github.com/php/php-src.git
synced 2025-01-27 14:13:41 +08:00
MFB: Fixed bug #43482 (array_pad() does not warn on very small pad
numbers).
This commit is contained in:
parent
b70d00a648
commit
7192e8af15
@ -2473,6 +2473,11 @@ PHP_FUNCTION(array_pad)
|
||||
/* Do some initial calculations */
|
||||
input_size = zend_hash_num_elements(Z_ARRVAL_P(input));
|
||||
pad_size_abs = abs(pad_size);
|
||||
if (pad_size_abs < 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "You may only pad up to 1048576 elements at a time");
|
||||
zval_dtor(return_value);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
do_pad = (input_size >= pad_size_abs) ? 0 : 1;
|
||||
|
||||
/* Copy the original array */
|
||||
|
Loading…
Reference in New Issue
Block a user