Fix using invalid string index in wxIsAbsolutePath()
Check if the path is at least two characters long before accessing its second character. Add test cases for wxIsAbsolutePath() on MS Windows. Closes https://github.com/wxWidgets/wxWidgets/pull/2262
This commit is contained in:
parent
401d547b2a
commit
9d0aee5ee6
2 changed files with 9 additions and 2 deletions
|
|
@ -525,6 +525,12 @@ void FileFunctionsTestCase::IsAbsolutePath()
|
|||
CPPUNIT_ASSERT( filename.MakeAbsolute() );
|
||||
// wxFileName::GetFullPath returns absolute path
|
||||
CPPUNIT_ASSERT_MESSAGE( msg, wxIsAbsolutePath(filename.GetFullPath()));
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
CPPUNIT_ASSERT( wxIsAbsolutePath("\\"));
|
||||
CPPUNIT_ASSERT( wxIsAbsolutePath("c:"));
|
||||
CPPUNIT_ASSERT( !wxIsAbsolutePath("c"));
|
||||
#endif
|
||||
}
|
||||
|
||||
void FileFunctionsTestCase::PathOnly()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue