Skip to content

Commit 678c532

Browse files
author
Ilia Alshanetsky
committed
MFB: Fixed bug #43482 (array_pad() does not warn on very small pad numbers).
1 parent 5b5211b commit 678c532

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ext/standard/array.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2684,6 +2684,11 @@ PHP_FUNCTION(array_pad)
26842684
/* Do some initial calculations */
26852685
input_size = zend_hash_num_elements(Z_ARRVAL_P(input));
26862686
pad_size_abs = abs(pad_size);
2687+
if (pad_size_abs < 0) {
2688+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "You may only pad up to 1048576 elements at a time");
2689+
zval_dtor(return_value);
2690+
RETURN_FALSE;
2691+
}
26872692
do_pad = (input_size >= pad_size_abs) ? 0 : 1;
26882693

26892694
/* Copy the original array */

0 commit comments

Comments
 (0)