From cefd7fb33fe6e9b6d1f70906783da16df97f2a32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 18 Jan 2020 12:29:03 +0100 Subject: [PATCH] Fix testrunner --- lib/checkbufferoverrun.cpp | 3 +++ lib/symboldatabase.cpp | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/checkbufferoverrun.cpp b/lib/checkbufferoverrun.cpp index dbefb03f3..6629af955 100644 --- a/lib/checkbufferoverrun.cpp +++ b/lib/checkbufferoverrun.cpp @@ -214,6 +214,9 @@ static bool getDimensionsEtc(const Token * const arrayToken, const Settings *set Dimension dim; dim.known = value->isKnown(); dim.tok = nullptr; + int typeSize = array->valueType()->typeSize(*settings); + if (typeSize == 0) + return false; dim.num = value->intvalue / array->valueType()->typeSize(*settings); dimensions->emplace_back(dim); } diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index e76d1a50c..5f23feb1a 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -6129,10 +6129,10 @@ std::string ValueType::dump() const MathLib::bigint ValueType::typeSize(const cppcheck::Platform &platform) const { - if (pointer) - return platform.sizeof_pointer; + //if (pointer) + // return platform.sizeof_pointer; - if (typeScope && typeScope->definedType) + if (typeScope && typeScope->definedType && typeScope->definedType->sizeOf) return typeScope->definedType->sizeOf; switch (type) {