Re: [PATCH] Fix integer overflow in calender.
| From: | Yasuo Ohgaki | Date: | Tue, 27 Jan 2015 00:30:48 +0000 |
| Subject: | Re: [PATCH] Fix integer overflow in calender. | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-81183@lists.php.net to get a copy of this message | ||
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
On Mon, Jan 19, 2015 at 8:34 PM, Joshua Rogers <git@internot.info> wrote:
> 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
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>