Skip to content

Signed integer overflow in ext/date/lib/unixtime2tm.c and ext/date/lib/parse_posix.c:493 #15491

@chongwick

Description

@chongwick

Description

The following code:

<?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
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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions