com php-src: Fixed bug #64895 Integer overflow in SndToJewish: NEWS ext/calendar/jewish.c ext/calendar/tests/jdtojewish64.phpt
| From: | Remi Collet | Date: | Wed, 22 May 2013 06:30:50 +0000 |
| Subject: | com php-src: Fixed bug #64895 Integer overflow in SndToJewish: NEWS ext/calendar/jewish.c ext/calendar/tests/jdtojewish64.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-72229@lists.php.net to get a copy of this message | ||
Commit: c50cef1dc54ffd1d0fb71d1afb8b2c3cb3c5b6ef
Author: Remi Collet <remi@php.net> Wed, 22 May 2013 08:28:05 +0200
Parents: d4ad8898247da4eca2221e564eb8c025bc783a0b
Branches: PHP-5.3
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c50cef1dc54ffd1d0fb71d1afb8b2c3cb3c5b6ef
Log:
Fixed bug #64895 Integer overflow in SndToJewish
Bugs:
https://bugs.php.net/64895
Changed paths:
M NEWS
M ext/calendar/jewish.c
M ext/calendar/tests/jdtojewish64.phpt
Diff:
diff --git a/NEWS b/NEWS
index ec735dd..fa038dc 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2013, PHP 5.3.26
+- Calendar:
+ . Fixed bug #64895 (Integer overflow in SndToJewish). (Remi)
+
- FPM:
. Fixed some possible memory or resource leaks and possible null dereference
detected by code coverity scan. (Remi)
diff --git a/ext/calendar/jewish.c b/ext/calendar/jewish.c
index 1e7a06c..fcc0e5c 100644
--- a/ext/calendar/jewish.c
+++ b/ext/calendar/jewish.c
@@ -272,7 +272,7 @@
#define HALAKIM_PER_METONIC_CYCLE (HALAKIM_PER_LUNAR_CYCLE * (12 * 19 + 7))
#define JEWISH_SDN_OFFSET 347997
-#define JEWISH_SDN_MAX 38245310 /* year 103759, 100000 A.D. */
+#define JEWISH_SDN_MAX 324542846L /* 12/13/887605, greater value raises interger overflow */
#define NEW_MOON_OF_CREATION 31524
#define SUNDAY 0
diff --git a/ext/calendar/tests/jdtojewish64.phpt b/ext/calendar/tests/jdtojewish64.phpt
index 50f7f33..9f01109 100644
--- a/ext/calendar/tests/jdtojewish64.phpt
+++ b/ext/calendar/tests/jdtojewish64.phpt
@@ -1,5 +1,5 @@
--TEST--
-Integer overflow in SndToJewish leads to php hang
+Bug #64895: Integer overflow in SndToJewish
--SKIPIF--
<?php
include 'skipif.inc';
@@ -9,10 +9,11 @@ if (PHP_INT_SIZE == 4) {
?>
--FILE--
<?php
-$a = array(38245310, 38245311, 9223372036854743639);
+$a = array(38245310, 324542846, 324542847, 9223372036854743639);
foreach ($a as $x) var_dump(jdtojewish($x));
--EXPECTF--
string(11) "2/22/103759"
+string(12) "12/13/887605"
string(5) "0/0/0"
string(5) "0/0/0"