]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't dereference invalid iterator in wxDateTime::ParseDate().
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 4 Jan 2010 10:59:40 +0000 (10:59 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 4 Jan 2010 10:59:40 +0000 (10:59 +0000)
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

src/common/datetimefmt.cpp

index cd4cb8397443ad75c10e60f4a896088d3256053f..cf02a55357e2b4955f8bcc881755fc8e973ce88c 100644 (file)
@@ -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