File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -370,7 +370,11 @@ char *sockets_strerror(int error) /* {{{ */
370370
371371#ifndef PHP_WIN32
372372 if (error < -10000 ) {
373- error = - error - 10000 ;
373+ if (error == INT_MIN ) {
374+ error = 2147473648 ;
375+ } else {
376+ error = - error - 10000 ;
377+ }
374378
375379#ifdef HAVE_HSTRERROR
376380 buf = hstrerror (error );
Original file line number Diff line number Diff line change @@ -3,20 +3,16 @@ GH-16267 - overflow on socket_strerror argument
33--EXTENSIONS--
44sockets
55--SKIPIF--
6- <?php if (PHP_INT_SIZE != 8 ) die (' skip 64-bit only ' ); ?>
6+ <?php if (PHP_INT_SIZE != 8 ) die (" skip this test is for 64bit platform only " ); ?>
77--FILE--
88<?php
9+ var_dump (socket_strerror (-2147483648 ));
910try {
10- socket_strerror (PHP_INT_MIN );
11- } catch (\ValueError $ e ) {
12- echo $ e ->getMessage () . PHP_EOL ;
13- }
14- try {
15- socket_strerror (PHP_INT_MAX );
11+ socket_strerror (2147483648 );
1612} catch (\ValueError $ e ) {
1713 echo $ e ->getMessage () . PHP_EOL ;
1814}
1915?>
2016--EXPECTF--
21- socket_strerror(): Argument #1 ($error_code) must be between %s and %s
22- socket_strerror(): Argument #1 ($error_code) must be between %s and %s
17+ string(%d) "%S"
18+ socket_strerror(): Argument #1 ($error_code) must be between %i and %d
You can’t perform that action at this time.
0 commit comments