From 4e2c2c7062f7cf92b61d8a474a94dee05de70760 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 30 Dec 2009 13:46:27 +0000 Subject: [PATCH] Don't create an invalid iterator in wxDateTime::ParseTime(). Creating an iterator pointing beyond the string end resulted in an assert from MSVC 9 CRT. Fix this by using wxString ctor taking length (which may be greater than the length of the string) instead of the one taking two iterators (which must both be valid). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63017 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/datetimefmt.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/common/datetimefmt.cpp b/src/common/datetimefmt.cpp index 39fc7f4546..cd4cb83974 100644 --- a/src/common/datetimefmt.cpp +++ b/src/common/datetimefmt.cpp @@ -1922,14 +1922,13 @@ wxDateTime::ParseTime(const wxString& time, wxString::const_iterator *end) for ( size_t n = 0; n < WXSIZEOF(stdTimes); n++ ) { const wxString timeString = wxGetTranslation(stdTimes[n].name); - const wxString::const_iterator p = time.begin() + timeString.length(); - if ( timeString.CmpNoCase(wxString(time.begin(), p)) == 0 ) + if ( timeString.CmpNoCase(wxString(time, timeString.length())) == 0 ) { // casts required by DigitalMars Set(stdTimes[n].hour, wxDateTime_t(0), wxDateTime_t(0)); if ( end ) - *end = p; + *end = time.begin() + timeString.length(); return true; } -- 2.45.2