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 |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
- | Authors: Shane Caraveo shane@caraveo.com |
- | Authors: Shane Caraveo shane@caraveo.com |
| Colin Viebrock colin@easydns.com |
| Hartmut Holzgraefe hholzgra@php.net |
| Wez Furlong wez@thebrainroom.com |
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
Hi Joshua,
Did you send PR or bug report for this?
We need PR or bug report for a bug fix.
Thank you.
--
Yasuo Ohgaki
yohgaki@ohgaki.net
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.phptdiff --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
|
| license@php.net so we can mail you a copy immediately.
|+----------------------------------------------------------------------+
- | Authors: Shane Caraveo shane@caraveo.com
|
- | Authors: Shane Caraveo shane@caraveo.com
|
| Colin Viebrock colin@easydns.com
|
| Hartmut Holzgraefe hholzgra@php.net
|
| Wez Furlong wez@thebrainroom.com
|
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--
+6227649163191.9.1
Hi Joshua,
Did you send PR or bug report for this?
We need PR or bug report for a bug fix.
Thank you.
https://github.com/php/php-src/pull/1009
https://github.com/php/php-src/pull/1008
--
-- Joshua Rogers <https://internot.info/