[php-src] PR #11183: Fix GH-11175 and GH-11177: Stream socket timeout undefined behaviour
| From: | nielsdos | Date: | Tue, 02 May 2023 22:05:58 +0000 |
| Subject: | [php-src] PR #11183: Fix GH-11175 and GH-11177: Stream socket timeout undefined behaviour | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-22431@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/11183
Author: nielsdos
Fixes GH-11175
Fixes GH-11177
A negative value like -1 may overflow and cause incorrect results in the timeout variable, which
causes an immediate timeout. As this is caused by undefined behaviour the exact behaviour depends on
the compiler, its version, and the platform.
A large overflow is also possible, if an extremely large timeout value is passed we also set an
indefinite timeout. This is because the timeout value is at least a 64-bit number and waiting for
UINT64_MAX/1000000 seconds is waiting about 584K years.