Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80807 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45384 invoked from network); 19 Jan 2015 11:35:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jan 2015 11:35:08 -0000 Authentication-Results: pb1.pair.com header.from=git@internot.info; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=git@internot.info; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain internot.info designates 185.57.82.47 as permitted sender) X-PHP-List-Original-Sender: git@internot.info X-Host-Fingerprint: 185.57.82.47 mail.internot.info Received: from [185.57.82.47] ([185.57.82.47:54838] helo=mail.internot.info) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5A/FF-64889-BEBECB45 for ; Mon, 19 Jan 2015 06:35:07 -0500 To: internals@lists.php.net Cc: Joshua Rogers Date: Mon, 19 Jan 2015 22:34:51 +1100 Message-ID: <1421667291-6763-1-git-send-email-git@internot.info> Subject: [PATCH] Fix integer overflow in calender. From: git@internot.info (Joshua Rogers) 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 | + | Authors: Shane Caraveo | | Colin Viebrock | | Hartmut Holzgraefe | | Wez Furlong | 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-- + +--FILE-- + +--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-- + +--FILE-- + +--EXPECT-- +622764916319 -- 1.9.1