mirror of
https://github.com/php/php-src.git
synced 2024-11-23 09:54:15 +08:00
e583890af0
when passing PHP_INT_MAX for the $length param we get this (with ubsan) `ext/sockets/sockets.c:1409:36: runtime error: signed integer overflow: 9223372036854775807 + 1 cannot be represented in type 'long int'` close GH-16382
20 lines
409 B
PHP
20 lines
409 B
PHP
--TEST--
|
|
socket_recvfrom overflow on length argument
|
|
--EXTENSIONS--
|
|
sockets
|
|
--SKIPIF--
|
|
<?php
|
|
if (strtolower(substr(PHP_OS, 0, 3)) === 'win') {
|
|
die('skip not valid for Windows.');
|
|
}
|
|
--FILE--
|
|
<?php
|
|
$s = socket_create(AF_UNIX, SOCK_DGRAM, 0);
|
|
$buf = $end = "";
|
|
var_dump(socket_recvfrom($s, $buf, PHP_INT_MAX, 0, $end));
|
|
var_dump(socket_recvfrom($s, $buf, -1, 0, $end));
|
|
?>
|
|
--EXPECT--
|
|
bool(false)
|
|
bool(false)
|