From 35ed902e3f15ad7c964c4bb36549415fb06094ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 7 Nov 2015 19:59:48 +0100 Subject: [PATCH] Try to fix crash when using getMaxValue() --- lib/checkbufferoverrun.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/checkbufferoverrun.cpp b/lib/checkbufferoverrun.cpp index 2a0a8ed98..7a1d226af 100644 --- a/lib/checkbufferoverrun.cpp +++ b/lib/checkbufferoverrun.cpp @@ -1080,7 +1080,7 @@ void CheckBufferOverrun::checkGlobalAndLocalVariable() bufferOverrunError(tok, tok->str()); } - if (Token::Match(tok, "%var% [") && tok->variable() && tok->variable()->isPointer()) { + if (Token::Match(tok, "%var% [") && tok->next()->astOperand2() && tok->variable() && tok->variable()->isPointer()) { const ValueFlow::Value *value = tok->next()->astOperand2()->getMaxValue(false); if (!value) continue;