File tree Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 44
55- Calendar:
66 . Fixed jdtogregorian overflow. (David Carlier)
7+ . Fixed cal_to_jd julian_days argument overflow. (David Carlier)
78
89- Core:
910 . Fail early in *nix configuration build script. (hakre)
Original file line number Diff line number Diff line change @@ -162,6 +162,11 @@ void SdnToGregorian(
162162
163163 /* Calculate the year and day of year (1 <= dayOfYear <= 366). */
164164 temp = ((temp % DAYS_PER_400_YEARS ) / 4 ) * 4 + 3 ;
165+
166+ if (century > ((INT_MAX / 100 ) - (temp / DAYS_PER_4_YEARS ))) {
167+ goto fail ;
168+ }
169+
165170 year = (century * 100 ) + (temp / DAYS_PER_4_YEARS );
166171 dayOfYear = (temp % DAYS_PER_4_YEARS ) / 4 + 1 ;
167172
Original file line number Diff line number Diff line change 1+ --TEST--
2+ GH-16834 (cal_from_jd from julian_day argument)
3+ --EXTENSIONS--
4+ calendar
5+ --SKIPIF--
6+ <?php if (PHP_INT_SIZE != 8 ) die ("skip for 64bit platforms only " ); ?>
7+ --FILE--
8+ <?php
9+ var_dump (cal_from_jd (076545676543223 , CAL_GREGORIAN ));
10+ ?>
11+ --EXPECTF--
12+ array(9) {
13+ ["date"]=>
14+ string(5) "0/0/0"
15+ ["month"]=>
16+ int(0)
17+ ["day"]=>
18+ int(0)
19+ ["year"]=>
20+ int(0)
21+ ["dow"]=>
22+ int(%d)
23+ ["abbrevdayname"]=>
24+ string(3) "%s"
25+ ["dayname"]=>
26+ string(9) "%s"
27+ ["abbrevmonth"]=>
28+ string(0) ""
29+ ["monthname"]=>
30+ string(0) ""
31+ }
You can’t perform that action at this time.
0 commit comments