ru_php/ext/standard/tests/strings/gh15613.phpt

27 lines
662 B
PHP

--TEST--
GH-15613 overflow on hex strings repeater value
--SKIPIF--
<?php
if (!getenv('RUN_RESOURCE_HEAVY_TESTS')) die('skip resource-heavy test');
if (PHP_INT_SIZE != 8) die("skip this test is for 64 bit platform only");
?>
--INI--
memory_limit=-1
--FILE--
<?php
try {
unpack('h2147483647', str_repeat('X', 2**31 + 10));
} catch (\ValueError $e) {
echo $e->getMessage() . PHP_EOL;
}
try {
unpack('H2147483647', str_repeat('X', 2**31 + 10));
} catch (\ValueError $e) {
echo $e->getMessage();
}
?>
--EXPECTF--
unpack(): Argument #1 ($format) repeater must be less than or equal to %d
unpack(): Argument #1 ($format) repeater must be less than or equal to %d