From 3db6502fbaea62a03ad1413fb8977dfcac70075d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Thu, 9 Jan 2020 21:25:23 +0100 Subject: [PATCH] Verification; Dangerous casting of void pointer --- lib/exprengine.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/exprengine.cpp b/lib/exprengine.cpp index 9b8a4226d..76c8731d9 100644 --- a/lib/exprengine.cpp +++ b/lib/exprengine.cpp @@ -1225,6 +1225,9 @@ static ExprEngine::ValuePtr executeCast(const Token *tok, Data &data) auto val = executeExpression(expr, data); if (expr->valueType() && expr->valueType()->type == ::ValueType::Type::VOID && expr->valueType()->pointer > 0) { + if (!tok->valueType() || expr->valueType()->pointer < tok->valueType()->pointer) + return std::make_shared(); + ::ValueType vt(*tok->valueType()); vt.pointer = 0; auto range = getValueRangeFromValueType(data.getNewSymbolName(), &vt, *data.settings);