File tree 2 files changed +36
-0
lines changed
2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -162,6 +162,11 @@ void SdnToGregorian(
162
162
163
163
/* Calculate the year and day of year (1 <= dayOfYear <= 366). */
164
164
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
+
165
170
year = (century * 100 ) + (temp / DAYS_PER_4_YEARS );
166
171
dayOfYear = (temp % DAYS_PER_4_YEARS ) / 4 + 1 ;
167
172
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