From 19bb2940cc2430aee3f28e7381a48e5da037cbb1 Mon Sep 17 00:00:00 2001 From: Robert Reif Date: Fri, 29 Jan 2010 16:00:48 +0100 Subject: [PATCH] Fixed #1325 (Segmentation fault in simplifyTypedef due to bad preprocessing) --- lib/preprocessor.cpp | 3 ++- lib/tokenize.cpp | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index 6c9eba245..55b44bea6 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -1626,7 +1626,8 @@ public: } optcomma = false; macrocode += str; - if (Token::Match(tok, "%var% %var%")) + if (Token::Match(tok, "%var% %var%") || + Token::Match(tok, "> >")) macrocode += " "; } } diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index dfc2046fc..26a4359ac 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -501,6 +501,12 @@ void Tokenizer::simplifyTypedef() while (end && end->next() && Token::Match(end->next(), ":: %type%")) end = end->tokAt(2); + if (!end) + { + // internal error + return; + } + tok = end; } else if (Token::Match(tok->next(), "%type%"))