Skip to content

Commit 6573656

Browse files
committed
ext/calendar: Fix integer overflow in GregorianToSdn()
1 parent 9ef92f0 commit 6573656

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

ext/calendar/tests/gh22602.phpt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ Bug GH-22602: (gregoriantojd() integer overflow with INT_MAX year)
44
calendar
55
--FILE--
66
<?php
7-
var_dump(gregoriantojd(5, 5, PHP_INT_MAX > 2147483647 ? 2147483647 : PHP_INT_MAX));
7+
$max = PHP_INT_MAX > 2147483647 ? 2147483647 : PHP_INT_MAX;
8+
$min = PHP_INT_MAX > 2147483647 ? -2147483648 : PHP_INT_MIN;
9+
10+
var_dump(gregoriantojd(5, 5, $max));
11+
var_dump(gregoriantojd(5, 5, $min));
812
?>
9-
--EXPECTF--
10-
int(%d)
13+
--EXPECT--
14+
int(0)
15+
int(0)

0 commit comments

Comments
 (0)