From c4419ea92048741d64b06ff2534ec491619d8b73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=E4ki?= Date: Sat, 2 Mar 2013 15:49:48 +0100 Subject: [PATCH] AST: create possible NULL pointer dereference if tokenlist is empty. Ticket: #4630 --- lib/tokenlist.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index 9ec11e827..59f0a0fe4 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -376,6 +376,10 @@ void TokenList::createAst() " [ " }; + // No tokens => bail out + if (!_front) + return; + for (unsigned int i = 0; i < sizeof(operators) / sizeof(*operators); ++i) { // TODO: extract operators to std::set - that should be faster if (*operators[i] == '>') { // Unary operators, parse from right to left