Fix #71894: AddressSanitizer: global-buffer-overflow in zif_cal_from_jd
authorChristoph M. Becker <cmb@php.net>
Thu, 28 Jul 2016 22:24:46 +0000 (00:24 +0200)
committerChristoph M. Becker <cmb@php.net>
Thu, 28 Jul 2016 23:04:21 +0000 (01:04 +0200)
commitf67ccd4a7b8fb4b9e55796e69b152e2a899ba3cd
tree8e1d2cac6c699bf4af3b3adeab56b77c25b513e9
parent5c458c9b025f6f654497f5e3d2ee53b4d1561454
Fix #71894: AddressSanitizer: global-buffer-overflow in zif_cal_from_jd

Julian days < 347998 denote invalid Jewish calendar dates, so
cal_from_jd($jd, CAL_JEWISH) and jdmonthname($jd, CAL_MONTH_JEWISH) should
actually fail. For BC we don't yet let them though, but we fix the OOB read
that happens in this case, and we also adjust cal_from_jd()'s return value
to have empty strings for "abbrevdayname" and "dayname" instead of "Sun"/
"Sunday" and NULL for "dow" instead of 0, which doesn't make any sense.
NEWS
ext/calendar/calendar.c
ext/calendar/tests/bug71894.phpt [new file with mode: 0644]