File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -160,6 +160,10 @@ void SdnToGregorian(
160
160
/* Calculate the century (year/100). */
161
161
century = temp / DAYS_PER_400_YEARS ;
162
162
163
+ if (century > ((INT_MAX / 100 ) - (temp / DAYS_PER_4_YEARS ))) {
164
+ goto fail ;
165
+ }
166
+
163
167
/* Calculate the year and day of year (1 <= dayOfYear <= 366). */
164
168
temp = ((temp % DAYS_PER_400_YEARS ) / 4 ) * 4 + 3 ;
165
169
year = (century * 100 ) + (temp / DAYS_PER_4_YEARS );
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
+ --FILE--
6
+ <?php
7
+ var_dump (cal_from_jd (076545676543223 , CAL_GREGORIAN ));
8
+ ?>
9
+ --EXPECTF--
10
+ array(9) {
11
+ ["date"]=>
12
+ string(5) "0/0/0"
13
+ ["month"]=>
14
+ int(0)
15
+ ["day"]=>
16
+ int(0)
17
+ ["year"]=>
18
+ int(0)
19
+ ["dow"]=>
20
+ int(%d)
21
+ ["abbrevdayname"]=>
22
+ string(3) "%s"
23
+ ["dayname"]=>
24
+ string(9) "%s"
25
+ ["abbrevmonth"]=>
26
+ string(0) ""
27
+ ["monthname"]=>
28
+ string(0) ""
29
+ }
You can’t perform that action at this time.
0 commit comments