diff options
| author | Antony Dovgal <tony2001@php.net> | 2006-07-11 14:16:26 +0000 |
|---|---|---|
| committer | Antony Dovgal <tony2001@php.net> | 2006-07-11 14:16:26 +0000 |
| commit | b491930ef63ba3bd369054dd7e9716e16e7dad1a (patch) | |
| tree | e084dca7e418563956b5fbae98c0472525587470 /ext/calendar/gregor.c | |
| parent | 5e93a7df9a06e7c1b5f787328000cbd346a3ec26 (diff) | |
| download | php-git-b491930ef63ba3bd369054dd7e9716e16e7dad1a.tar.gz | |
fix segfault in jdmonthname(), add test
Diffstat (limited to 'ext/calendar/gregor.c')
| -rw-r--r-- | ext/calendar/gregor.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/calendar/gregor.c b/ext/calendar/gregor.c index f48950901a..c9c0bf761b 100644 --- a/ext/calendar/gregor.c +++ b/ext/calendar/gregor.c @@ -154,6 +154,13 @@ void SdnToGregorian( } temp = (sdn + GREGOR_SDN_OFFSET) * 4 - 1; + if (temp < 0) { + *pYear = 0; + *pMonth = 0; + *pDay = 0; + return; + } + /* Calculate the century (year/100). */ century = temp / DAYS_PER_400_YEARS; |
