Ok, besides the potential issue about wxString in 2.9.x+, I found that the issue reported is definitely related to an unsafe pointer access.
Look at the code snippet:
bool ParserThread::GetBaseArgs(const wxString& args, wxString& baseArgs)
{
const wxChar* ptr = args; // pointer to current char in args string
wxString word; // compiled word of last arg
bool skip = false; // skip the next char (do not add to stripped args)
bool sym = false; // current char symbol
bool one = true; // only one argument
TRACE(_T("GetBaseArgs() : args='%s'."), args.wx_str());
baseArgs.Alloc(args.Len() + 1);
// Verify ptr is valid (still within the range of the string)
while (*ptr != ParserConsts::null)
{
switch (*ptr)
{
case ParserConsts::eol_chr:
while (*ptr <= ParserConsts::space_chr) // this the the line parserthread.cpp:2859 reported by valgrind
++ptr;
break;
case ParserConsts::space_chr:
...
You see, when we meet an "eol_chr", we are going to run a loop:
while (*ptr <= ParserConsts::space_chr) // this the the line parserthread.cpp:2859 reported by valgrind
++ptr;
You see, we don't check whether we have meet a "ParserConsts::null" in the loop, so I think the simple fix is adding this check. Any ideas?