summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rw-r--r--ext/calendar/calendar.c2
-rw-r--r--ext/calendar/gregor.c2
-rw-r--r--ext/calendar/julian.c2
-rw-r--r--ext/calendar/tests/gregoriantojd_overflow.phpt10
-rw-r--r--ext/calendar/tests/juliantojd_overflow.phpt10
6 files changed, 26 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index 798897da5d..8aeb463c9f 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,9 @@ PHP NEWS
10 Nov 2016, PHP 7.1.0RC6
+- Calendar:
+ . Fix integer overflows (Joshua Rogers)
+
- Core:
. Fixded bug #72736 (Slow performance when fetching large dataset with mysqli
/ PDO). (Dmitry)
diff --git a/ext/calendar/calendar.c b/ext/calendar/calendar.c
index 76248a6554..b5d21a4dcd 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 069fe6eb5a..4c91fa8d54 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 904727ff04..6ab0854c3b 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 0000000000..a189cc80c3
--- /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 0000000000..f2f5aa182d
--- /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