Skip to content

Commit 1b8cfaf

Browse files
Joshua Rogerskrakjoe
authored andcommitted
Fix integer overflow in calender.
Fix int overflows in conversation functions for calendar. Add tests for the overflows.
1 parent f578ce3 commit 1b8cfaf

File tree

5 files changed

+23
-3
lines changed

5 files changed

+23
-3
lines changed

ext/calendar/calendar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
| obtain it through the world-wide-web, please send a note to |
1313
| license@php.net so we can mail you a copy immediately. |
1414
+----------------------------------------------------------------------+
15-
| Authors: Shane Caraveo <shane@caraveo.com> |
15+
| Authors: Shane Caraveo <shane@caraveo.com> |
1616
| Colin Viebrock <colin@easydns.com> |
1717
| Hartmut Holzgraefe <hholzgra@php.net> |
1818
| Wez Furlong <wez@thebrainroom.com> |

ext/calendar/gregor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ zend_long GregorianToSdn(
195195
int inputMonth,
196196
int inputDay)
197197
{
198-
int year;
198+
zend_long year;
199199
int month;
200200

201201
/* check for invalid dates */

ext/calendar/julian.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ zend_long JulianToSdn(
217217
int inputMonth,
218218
int inputDay)
219219
{
220-
int year;
220+
zend_long year;
221221
int month;
222222

223223
/* check for invalid dates */
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--TEST--
2+
gregoriantojd()
3+
--SKIPIF--
4+
<?php include 'skipif.inc'; ?>
5+
--FILE--
6+
<?php
7+
echo gregoriantojd(5, 5, 6000000) . "\n";
8+
?>
9+
--EXPECT--
10+
2193176185
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--TEST--
2+
juliantojd()
3+
--SKIPIF--
4+
<?php include 'skipif.inc'; ?>
5+
--FILE--
6+
<?php
7+
echo juliantojd(5, 5, 6000000000) . "\n";
8+
?>
9+
--EXPECT--
10+
622764916319

0 commit comments

Comments
 (0)