From: Antony Dovgal Date: Fri, 8 Sep 2006 20:22:23 +0000 (+0000) Subject: fix #38721 (date_parse() invalid read) X-Git-Tag: RELEASE_1_0_0RC1~1728 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cb04bb6a4f2f5a133f242fe49755c92788785c34;p=php fix #38721 (date_parse() invalid read) --- diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c index 0ebf56c4e6..4f588f3507 100644 --- a/ext/date/lib/parse_date.c +++ b/ext/date/lib/parse_date.c @@ -22140,13 +22140,15 @@ timelib_time* timelib_strtotime(char *s, int len, struct timelib_error_container in.errors->error_count = 0; in.errors->error_messages = NULL; - while (isspace(*s) && s < e) { - s++; - } - while (isspace(*e) && e > s) { - e--; - } - if (e - s < 1) { + if (len > 0) { + while (isspace(*s) && s < e) { + s++; + } + while (isspace(*e) && e > s) { + e--; + } + } + if (e - s < 1){ in.time = timelib_time_ctor(); add_error(&in, "Empty string"); if (errors) {