Skip to content

Commit c50cef1

Browse files
committed
Fixed bug #64895 Integer overflow in SndToJewish
1 parent d4ad889 commit c50cef1

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? 2013, PHP 5.3.26
44

5+
- Calendar:
6+
. Fixed bug #64895 (Integer overflow in SndToJewish). (Remi)
7+
58
- FPM:
69
. Fixed some possible memory or resource leaks and possible null dereference
710
detected by code coverity scan. (Remi)

ext/calendar/jewish.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@
272272
#define HALAKIM_PER_METONIC_CYCLE (HALAKIM_PER_LUNAR_CYCLE * (12 * 19 + 7))
273273

274274
#define JEWISH_SDN_OFFSET 347997
275-
#define JEWISH_SDN_MAX 38245310 /* year 103759, 100000 A.D. */
275+
#define JEWISH_SDN_MAX 324542846L /* 12/13/887605, greater value raises interger overflow */
276276
#define NEW_MOON_OF_CREATION 31524
277277

278278
#define SUNDAY 0

ext/calendar/tests/jdtojewish64.phpt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
Integer overflow in SndToJewish leads to php hang
2+
Bug #64895: Integer overflow in SndToJewish
33
--SKIPIF--
44
<?php
55
include 'skipif.inc';
@@ -9,10 +9,11 @@ if (PHP_INT_SIZE == 4) {
99
?>
1010
--FILE--
1111
<?php
12-
$a = array(38245310, 38245311, 9223372036854743639);
12+
$a = array(38245310, 324542846, 324542847, 9223372036854743639);
1313

1414
foreach ($a as $x) var_dump(jdtojewish($x));
1515
--EXPECTF--
1616
string(11) "2/22/103759"
17+
string(12) "12/13/887605"
1718
string(5) "0/0/0"
1819
string(5) "0/0/0"

0 commit comments

Comments
 (0)