diff --git a/lib/bughuntingchecks.cpp b/lib/bughuntingchecks.cpp index b4cbb55c3..9e0f612de 100644 --- a/lib/bughuntingchecks.cpp +++ b/lib/bughuntingchecks.cpp @@ -156,7 +156,12 @@ static void bufferOverflow(const Token *tok, const ExprEngine::Value &value, Exp break; } std::shared_ptr arrayValue2 = std::dynamic_pointer_cast(otherValue); - if (arrayValue2 && arrayValue2->size.size() == 1 && isLessThan(dataBase, arrayValue->size[0], arrayValue2->size[0])) { + if (!arrayValue2 || arrayValue2->size.size() != 1) { + overflowArgument = argnr; + bailout = true; + break; + } + if (isLessThan(dataBase, arrayValue->size[0], arrayValue2->size[0])) { overflowArgument = argnr; break; }