mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
Fixed possible integer overflow in str_repeat().
This commit is contained in:
parent
dcf0c70950
commit
aab9718253
@ -3787,6 +3787,10 @@ PHP_FUNCTION(str_repeat)
|
||||
|
||||
/* Initialize the result string */
|
||||
result_len = Z_STRLEN_PP(input_str) * Z_LVAL_PP(mult);
|
||||
if (result_len < 1 || result_len > 2147483647) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "You may not create strings longer then 2147483647 bytes");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
result = (char *)emalloc(result_len + 1);
|
||||
|
||||
/* Heavy optimization for situations where input string is 1 byte long */
|
||||
|
Loading…
Reference in New Issue
Block a user