--- embedaddon/php/ext/date/lib/parse_date.re 2013/10/14 08:02:09 1.1.1.4 +++ embedaddon/php/ext/date/lib/parse_date.re 2014/06/15 20:03:41 1.1.1.5 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: parse_date.re,v 1.1.1.4 2013/10/14 08:02:09 misho Exp $ */ +/* $Id: parse_date.re,v 1.1.1.5 2014/06/15 20:03:41 misho Exp $ */ #include "timelib.h" @@ -401,9 +401,12 @@ static timelib_sll timelib_meridian_with_check(char ** { timelib_sll retval = 0; - while (!strchr("AaPp", **ptr)) { + while (**ptr && !strchr("AaPp", **ptr)) { ++*ptr; } + if(!**ptr) { + return TIMELIB_UNSET; + } if (**ptr == 'a' || **ptr == 'A') { if (h == 12) { retval = -12; @@ -750,7 +753,7 @@ const static timelib_tz_lookup_table* zone_search(cons /* Still didn't find anything, let's find the zone solely based on * offset/isdst then */ for (fmp = timelib_timezone_fallbackmap; fmp->name; fmp++) { - if ((fmp->gmtoffset * 3600) == gmtoffset && fmp->type == isdst) { + if ((fmp->gmtoffset * 60) == gmtoffset && fmp->type == isdst) { return fmp; } } @@ -2043,7 +2046,7 @@ timelib_time *timelib_parse_from_format(char *format, TIMELIB_CHECK_NUMBER; sec = timelib_get_nr_ex((char **) &ptr, 2, &length); if (sec == TIMELIB_UNSET || length != 2) { - add_pbf_error(s, "A two second minute could not be found", string, begin); + add_pbf_error(s, "A two digit second could not be found", string, begin); } else { s->time->s = sec; } @@ -2131,6 +2134,10 @@ timelib_time *timelib_parse_from_format(char *format, break; case '\\': /* escaped char */ + if(!fptr[1]) { + add_pbf_error(s, "Escaped character expected", string, begin); + break; + } fptr++; if (*ptr == *fptr) { ++ptr;