Fix in overflows in conversation functions for calendar.
Add tests for the overflows.
---
ext/calendar/calendar.c | 2 +-
ext/calendar/gregor.c | 2 +-
ext/calendar/julian.c | 2 +-
ext/calendar/tests/gregoriantojd_overflow.phpt | 10 ++++++++++
ext/calendar/tests/juliantojd_overflow.phpt | 10 ++++++++++
5 files changed, 23 insertions(+), 3 deletions(-)
create mode 100644 ext/calendar/tests/gregoriantojd_overflow.phpt
create mode 100644 ext/calendar/tests/juliantojd_overflow.phpt
diff --git a/ext/calendar/calendar.c b/ext/calendar/calendar.c
index f84335b..6e94047 100644
--- a/ext/calendar/calendar.c
+++ b/ext/calendar/calendar.c
@@ -12,7 +12,7 @@
| obtain it through the world-wide-web, please send a note to |
| [email protected] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
- | Authors: Shane Caraveo <[email protected]> |
+ | Authors: Shane Caraveo <[email protected]> |
| Colin Viebrock <[email protected]> |
| Hartmut Holzgraefe <[email protected]> |
| Wez Furlong <[email protected]> |
diff --git a/ext/calendar/gregor.c b/ext/calendar/gregor.c
index 069fe6e..4c91fa8 100644
--- a/ext/calendar/gregor.c
+++ b/ext/calendar/gregor.c
@@ -195,7 +195,7 @@ zend_long GregorianToSdn(
int inputMonth,
int inputDay)
{
- int year;
+ zend_long year;
int month;
/* check for invalid dates */
diff --git a/ext/calendar/julian.c b/ext/calendar/julian.c
index 904727f..6ab0854 100644
--- a/ext/calendar/julian.c
+++ b/ext/calendar/julian.c
@@ -217,7 +217,7 @@ zend_long JulianToSdn(
int inputMonth,
int inputDay)
{
- int year;
+ zend_long year;
int month;
/* check for invalid dates */
diff --git a/ext/calendar/tests/gregoriantojd_overflow.phpt
b/ext/calendar/tests/gregoriantojd_overflow.phpt
new file mode 100644
index 0000000..a189cc8
--- /dev/null
+++ b/ext/calendar/tests/gregoriantojd_overflow.phpt
@@ -0,0 +1,10 @@
+--TEST--
+gregoriantojd()
+--SKIPIF--
+<?php include 'skipif.inc'; ?>
+--FILE--
+<?php
+echo gregoriantojd(5, 5, 6000000) . "\n";
+?>
+--EXPECT--
+2193176185
diff --git a/ext/calendar/tests/juliantojd_overflow.phpt
b/ext/calendar/tests/juliantojd_overflow.phpt
new file mode 100644
index 0000000..f2f5aa1
--- /dev/null
+++ b/ext/calendar/tests/juliantojd_overflow.phpt
@@ -0,0 +1,10 @@
+--TEST--
+juliantojd()
+--SKIPIF--
+<?php include 'skipif.inc'; ?>
+--FILE--
+<?php
+echo juliantojd(5, 5, 6000000000) . "\n";
+?>
+--EXPECT--
+622764916319
--
1.9.1
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php