From: Vadim Zeitlin Date: Mon, 4 Jan 2010 10:59:40 +0000 (+0000) Subject: Don't dereference invalid iterator in wxDateTime::ParseDate(). X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/462f4f19b5e20055a59ca93cdc19094552a416f1 Don't dereference invalid iterator in wxDateTime::ParseDate(). If the string passed to this method contained only spaces (possibly 0 of them, i.e. was empty) we would dereference the end string iterator. Fix this by adding an explicit test for "p != pEnd". git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63060 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/datetimefmt.cpp b/src/common/datetimefmt.cpp index cd4cb83974..cf02a55357 100644 --- a/src/common/datetimefmt.cpp +++ b/src/common/datetimefmt.cpp @@ -1559,7 +1559,7 @@ wxDateTime::ParseDate(const wxString& date, wxString::const_iterator *end) const wxString::const_iterator pEnd = date.end(); wxString::const_iterator p = pBegin; - while ( wxIsspace(*p) ) + while ( p != pEnd && wxIsspace(*p) ) p++; // some special cases