Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign
Using uninitialized memory (valgrind report)
ollydbg:
--- Code: --- src/plugins/codecompletion/parser/parserthread.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/plugins/codecompletion/parser/parserthread.cpp b/src/plugins/codecompletion/parser/parserthread.cpp
index b614aca..221b548 100644
--- a/src/plugins/codecompletion/parser/parserthread.cpp
+++ b/src/plugins/codecompletion/parser/parserthread.cpp
@@ -2856,7 +2856,7 @@ bool ParserThread::GetBaseArgs(const wxString& args, wxString& baseArgs)
switch (*ptr)
{
case ParserConsts::eol_chr:
- while (*ptr <= ParserConsts::space_chr)
+ while (*ptr != ParserConsts::null && *ptr <= ParserConsts::space_chr)
++ptr;
break;
case ParserConsts::space_chr:
@@ -2876,7 +2876,7 @@ bool ParserThread::GetBaseArgs(const wxString& args, wxString& baseArgs)
case ParserConsts::ptr_chr: // handle pointer args
// handle multiple pointer like in: main (int argc, void** argv)
// or ((int *, char ***))
- while (*(ptr+1) == ParserConsts::ptr_chr)
+ while (*(ptr+1) != ParserConsts::null && *(ptr+1) == ParserConsts::ptr_chr)
{
baseArgs << *ptr; // append one more '*' to baseArgs
ptr++; // next char
--- End code ---
Does the patch above fix the issue reported by valgrind? (I just add some null check when accessing by pointer de-reference)
Thanks.
ollydbg:
Committed in r9416, I hope it fix the bug.
Navigation
[0] Message Index
[*] Previous page
Go to full version