We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3d80d98 commit 4527496Copy full SHA for 4527496
ext/calendar/gregor.c
@@ -153,6 +153,10 @@ void SdnToGregorian(
153
}
154
temp = (sdn + GREGOR_SDN_OFFSET) * 4 - 1;
155
156
+ if (temp < 0 || (temp / DAYS_PER_400_YEARS) > INT_MAX) {
157
+ goto fail;
158
+ }
159
+
160
/* Calculate the century (year/100). */
161
century = temp / DAYS_PER_400_YEARS;
162
ext/calendar/tests/gh16235.phpt
@@ -0,0 +1,13 @@
1
+--TEST--
2
+GH-16235 (jdtogregorian overflow on argument)
3
+--EXTENSIONS--
4
+calendar
5
+--SKIPIF--
6
+<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
7
+--FILE--
8
+<?php
9
+jdtogregorian(92233658792494800);
10
+echo "DONE";
11
+?>
12
+--EXPECT--
13
+DONE
0 commit comments