1
0
mirror of https://github.com/php/php-src.git synced 2026-04-20 14:31:06 +02:00
Files
archived-php-src/ext/standard/tests/strings/bug72146.phpt
Christoph M. Becker 33f8dfb15a Fix #72146: Integer overflow on substr_replace
Adding two `zend_long`s may overflow, and casting `size_t` to
`zend_long` may truncate; we can avoid this here by enforcing unsigned
arithmetic.

Closes GH-7240.
2021-07-15 12:54:28 +02:00

12 lines
189 B
PHP

--TEST--
Bug #72146 (Integer overflow on substr_replace)
--FILE--
<?php
var_dump(substr_replace(["ABCDE"], "123", 3, PHP_INT_MAX));
?>
--EXPECT--
array(1) {
[0]=>
string(6) "ABC123"
}