Verification; Dangerous casting of void pointer

This commit is contained in:
Daniel Marjamäki 2020-01-09 21:25:23 +01:00
parent b8aa71bc87
commit 3db6502fba
1 changed files with 3 additions and 0 deletions

View File

@ -1225,6 +1225,9 @@ static ExprEngine::ValuePtr executeCast(const Token *tok, Data &data)
auto val = executeExpression(expr, data); auto val = executeExpression(expr, data);
if (expr->valueType() && expr->valueType()->type == ::ValueType::Type::VOID && expr->valueType()->pointer > 0) { 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<ExprEngine::UninitValue>();
::ValueType vt(*tok->valueType()); ::ValueType vt(*tok->valueType());
vt.pointer = 0; vt.pointer = 0;
auto range = getValueRangeFromValueType(data.getNewSymbolName(), &vt, *data.settings); auto range = getValueRangeFromValueType(data.getNewSymbolName(), &vt, *data.settings);