Skip to content

Conversation

@clue
Copy link
Member

@clue clue commented Mar 29, 2021

This changeset fixes an integer overflow for the TCP/IP chunk size on 32 bit platforms. This does not affect common 64 bit platforms and/or the normal UDP query, so this can be rarely observed in practice.

$ docker run -it --rm yukoff/php-32bit
Interactive shell

php > var_dump(PHP_INT_MAX);
int(2147483647)
php > var_dump((1 << 31));
int(-2147483648)
php > var_dump((1 << 31) - 1);
float(-2147483649)
php > var_dump((int)((1 << 31) - 1));
int(2147483647)

Closes #176
Builds on top of #172, in particular https://github.com/reactphp/dns/pull/172/files#diff-cde9e8c539defb086472120d9570d3cb4ca4f02924bd010e8bfce932079a5ddaR188

@clue clue added the bug label Mar 29, 2021
@clue clue added this to the v1.6.0 milestone Mar 29, 2021
@clue clue requested review from WyriHaximus and jsor March 30, 2021 08:26
@WyriHaximus WyriHaximus merged commit 92a1727 into reactphp:master Apr 19, 2021
@clue clue deleted the 32bit branch April 19, 2021 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test failure because f integer overflow on 32-bit system

2 participants