From 62810af7f359931ab49fe9fc0f21974b638a7fea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 2 Dec 2020 23:06:11 +0100 Subject: [PATCH] Tokenizer: Avoid null pointer dereference in garbage code --- lib/tokenize.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 2729290b8..d3a3e575a 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -5185,7 +5185,7 @@ void Tokenizer::splitTemplateRightAngleBrackets(bool check) vars.insert(tok->strAt(2)); // Ticket #6181: normalize C++11 template parameter list closing syntax - if (tok->str() == "<" && mTemplateSimplifier->templateParameters(tok) && vars.find(tok->previous()->str()) == vars.end()) { + if (tok->previous() && tok->str() == "<" && mTemplateSimplifier->templateParameters(tok) && vars.find(tok->previous()->str()) == vars.end()) { Token *endTok = tok->findClosingBracket(); if (check) { if (Token::Match(endTok, ">>|>>="))