Fix crashes in wxDateTime::ParseDate() for some invalid dates.
Parsing an incomplete date with nothing but whitespace and/or date delimiter characters at the end crashed as we happily went beyond the end of string. Fix this by not using a loop which didn't check for the iterator validity. Closes #12685. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66166 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
3e90629b6b
commit
e4f54cce1e
@ -1625,9 +1625,10 @@ wxDateTime::ParseDate(const wxString& date, wxString::const_iterator *end)
|
||||
while ( p != pEnd )
|
||||
{
|
||||
// skip white space and date delimiters
|
||||
while ( wxStrchr(".,/-\t\r\n ", *p) )
|
||||
if ( wxStrchr(".,/-\t\r\n ", *p) )
|
||||
{
|
||||
++p;
|
||||
continue;
|
||||
}
|
||||
|
||||
// modify copy of the iterator as we're not sure if the next token is
|
||||
|
@ -973,6 +973,7 @@ void DateTimeTestCase::TestDateParse()
|
||||
{ "29 Feb 2006" },
|
||||
{ "31/04/06" },
|
||||
{ "bloordyblop" },
|
||||
{ "2 . . " },
|
||||
};
|
||||
|
||||
// special cases
|
||||
|
Loading…
Reference in New Issue
Block a user