Skip to content

Commit dc1127e

Browse files
committed
following up.
1 parent f119df3 commit dc1127e

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

ext/sockets/sockets.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,14 @@ char *sockets_strerror(int error) /* {{{ */
368368
{
369369
const char *buf;
370370

371+
ZEND_ASSERT(error > INT_MIN);
371372
#ifndef PHP_WIN32
372373
if (error < -10000) {
373-
error = -error - 10000;
374+
if (error == INT_MIN) {
375+
error = 2147473648;
376+
} else {
377+
error = -error - 10000;
378+
}
374379

375380
#ifdef HAVE_HSTRERROR
376381
buf = hstrerror(error);

ext/sockets/tests/gh16267.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ try {
1818
}
1919
?>
2020
--EXPECTF--
21-
socket_strerror(): Argument #1 ($error_code) must be between %s and %d
22-
socket_strerror(): Argument #1 ($error_code) must be between %s and %d
21+
socket_strerror(): Argument #1 ($error_code) must be between %i and %d
22+
socket_strerror(): Argument #1 ($error_code) must be between %i and %d

0 commit comments

Comments
 (0)