Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix integer overflow for TCP/IP chunk size on 32 bit platforms #177

Merged
merged 1 commit into from
Apr 19, 2021

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 jsor and WyriHaximus 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