Nothing Special   »   [go: up one dir, main page]

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

php_network.h integer overflow #15937

Closed
chongwick opened this issue Sep 17, 2024 · 1 comment
Closed

php_network.h integer overflow #15937

chongwick opened this issue Sep 17, 2024 · 1 comment

Comments

@chongwick
Copy link

Description

The following code:

<?php
array( 'timeout' => PHP_INT_MAX, 'max_redirects' => PHP_INT_MAX, 'user_agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3', ), ));
$fp = fopen('http://example.com', 'r', false, $stream);

Resulted in this output:

/home/dan/php-8.3.9/main/php_network.h:166:29: runtime error: signed integer overflow: -9223372036854775808 * 1000 cannot be represented in type 'long int'

PHP Version

8.3.9

Operating System

No response

@cmb69
Copy link
Member
cmb69 commented Sep 17, 2024

php-src/main/php_network.h

Lines 163 to 168 in 67ba890

static inline int php_tvtoto(struct timeval *timeouttv)
{
if (timeouttv) {
return (timeouttv->tv_sec * 1000) + (timeouttv->tv_usec / 1000);
}
return -1;

looks indeed fishy.

@devnexen devnexen self-assigned this Sep 17, 2024
devnexen added a commit to devnexen/php-src that referenced this issue Sep 17, 2024
@devnexen devnexen linked a pull request Sep 17, 2024 that will close this issue
jorgsowa pushed a commit to jorgsowa/php-src that referenced this issue Oct 1, 2024
jorgsowa pushed a commit to jorgsowa/php-src that referenced this issue Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants