Skip to content

Commit 50adc67

Browse files
committed
astutils.cpp: avoid potential NULL dereference in isAliasOf()
1 parent dd591a8 commit 50adc67

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

lib/astutils.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1064,9 +1064,11 @@ bool isAliasOf(const Token *tok, nonneg int varid, bool* inconclusive)
10641064

10651065
bool isAliasOf(const Token* tok, const Token* expr, int* indirect)
10661066
{
1067-
const Token* r = nullptr;
10681067
if (indirect)
10691068
*indirect = 1;
1069+
if (!tok)
1070+
return false;
1071+
const Token* r = nullptr;
10701072
for (const ReferenceToken& ref : tok->refs()) {
10711073
const bool pointer = astIsPointer(ref.token);
10721074
r = findAstNode(expr, [&](const Token* childTok) {

0 commit comments

Comments
 (0)