File tree 3 files changed +29
-2
lines changed
3 files changed +29
-2
lines changed Original file line number Diff line number Diff line change 7
7
. Fixed GH-16241: easter_days/easter_date overflow on year argument.
8
8
(David Carlier)
9
9
. Fixed GH-16263: jddayofweek overflow. (cmb)
10
+ . Fixed GH-16234: jewishtojd overflow. (nielsdos)
10
11
11
12
- CLI:
12
13
. Fixed bug GH-16137: duplicate http headers when set several times by
Original file line number Diff line number Diff line change @@ -433,16 +433,31 @@ static void MoladOfMetonicCycle(
433
433
zend_long * pMoladHalakim )
434
434
{
435
435
register zend_ulong r1 , r2 , d1 , d2 ;
436
+ zend_long chk ;
436
437
437
438
/* Start with the time of the first molad after creation. */
438
439
r1 = NEW_MOON_OF_CREATION ;
440
+ chk = (zend_long )metonicCycle ;
441
+
442
+ if (chk > (ZEND_LONG_MAX - NEW_MOON_OF_CREATION ) / (HALAKIM_PER_METONIC_CYCLE & 0xFFFF )) {
443
+ * pMoladDay = 0 ;
444
+ * pMoladHalakim = 0 ;
445
+ return ;
446
+ }
439
447
440
448
/* Calculate metonicCycle * HALAKIM_PER_METONIC_CYCLE. The upper 32
441
449
* bits of the result will be in r2 and the lower 16 bits will be
442
450
* in r1. */
443
- r1 += metonicCycle * (HALAKIM_PER_METONIC_CYCLE & 0xFFFF );
451
+ r1 += chk * (HALAKIM_PER_METONIC_CYCLE & 0xFFFF );
452
+
453
+ if (chk > (ZEND_LONG_MAX - (r1 >> 16 )) / ((HALAKIM_PER_METONIC_CYCLE >> 16 ) & 0xFFFF )) {
454
+ * pMoladDay = 0 ;
455
+ * pMoladHalakim = 0 ;
456
+ return ;
457
+ }
458
+
444
459
r2 = r1 >> 16 ;
445
- r2 += metonicCycle * ((HALAKIM_PER_METONIC_CYCLE >> 16 ) & 0xFFFF );
460
+ r2 += chk * ((HALAKIM_PER_METONIC_CYCLE >> 16 ) & 0xFFFF );
446
461
447
462
/* Calculate r2r1 / HALAKIM_PER_DAY. The remainder will be in r1, the
448
463
* upper 16 bits of the quotient will be in d2 and the lower 16 bits
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ GH-16234 jewishtojd overflow on year argument
3
+ --EXTENSIONS--
4
+ calendar
5
+ --FILE--
6
+ <?php
7
+ jewishtojd (1218182888 , 1 , 1218182888 );
8
+ echo "DONE " ;
9
+ ?>
10
+ --EXPECT--
11
+ DONE
You can’t perform that action at this time.
0 commit comments