[php-src] Issue #15491: Signed integer overflow in ext/date/lib/unixtime2tm.c and ext/date/lib/parse_posix.c:493
| From: | chongwick | Date: | Mon, 19 Aug 2024 12:01:54 +0000 |
| Subject: | [php-src] Issue #15491: Signed integer overflow in ext/date/lib/unixtime2tm.c and ext/date/lib/parse_posix.c:493 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247528@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/15491
Author: chongwick
### Description
The following code:
```php
<?php
date_default_timezone_set("Asia/Tokyo");
echo date(DATE_RFC2822, PHP_INT_MAX);
```
Resulted in this output:
```
php-8.1.29/ext/date/lib/unixtime2tm.c:142:4: runtime error: signed integer overflow:
9223372036854775807 + 32400 cannot be represented in type 'long long int'
```
Changing the timezone changed the location of the error:
```php
<?php
date_default_timezone_set("America/Los_Angeles");
echo date(DATE_RFC2822, PHP_INT_MAX);
```
Resulted in this output:
```
php-8.1.29/ext/date/lib/parse_posix.c:493:22: runtime error: signed integer overflow:
106751991167328 * 86400 cannot be represented in type 'long long int'
```
### PHP Version
PHP 8.1.29
### Operating System
_No response_