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

tm2unixtime.c:458:4 integer overflow #16864

Open
chongwick opened this issue Nov 19, 2024 · 1 comment
Open

tm2unixtime.c:458:4 integer overflow #16864

chongwick opened this issue Nov 19, 2024 · 1 comment

Comments

@chongwick
Copy link

Description

The following code:

<?php
$v1 = PHP_INT_MIN;
$v4 = new DateTime();
$v4->setDate($v1, 1, 1);

Resulted in this output:

/home/dan/php-src/ext/date/lib/tm2unixtime.c:458:4: runtime error: signed integer overflow: -9223372036854775808 - 1 cannot be represented in type 'long long int'

But I expected this output instead:

PHP Version

PHP 8.4-dev

Operating System

No response

@cmb69
Copy link
Member

cmb69 commented Nov 20, 2024

@derickr, implementing proper overflow handling in timelib might be difficult, but it would likely be helpful if the public functions would implement some pre-condition checks (or at least state the pre-conditions) for the supported range of the arguments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants