diff --git a/lib/checkbufferoverrun.cpp b/lib/checkbufferoverrun.cpp index 4ca040391..6ad4fff89 100644 --- a/lib/checkbufferoverrun.cpp +++ b/lib/checkbufferoverrun.cpp @@ -712,7 +712,7 @@ void CheckBufferOverrun::checkScope(const Token *tok, const std::vector 0) { ArrayInfo arrayInfo(0U, varnames, total_size / size, size); if (Token::Match(tok, ("%var% ( " + varnames + " ,").c_str())) diff --git a/test/testbufferoverrun.cpp b/test/testbufferoverrun.cpp index b5c9a3868..8d6c4c5f9 100644 --- a/test/testbufferoverrun.cpp +++ b/test/testbufferoverrun.cpp @@ -1036,6 +1036,15 @@ private: " x(obj.delay, 123);\n" "}\n"); ASSERT_EQUALS("[test.cpp:11] -> [test.cpp:6]: (error) Array 'obj . delay[3]' index 4 out of bounds\n", errout.str()); + + check("struct s1 {\n" + " float a[0];\n" + "};\n" + "\n" + "void f() {\n" + " struct s1 *obj;\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); } void array_index_multidim()