#2133 (cppcheck: floating point exception)
This commit is contained in:
parent
6200d4505a
commit
79583ee45d
|
@ -712,7 +712,7 @@ void CheckBufferOverrun::checkScope(const Token *tok, const std::vector<std::str
|
||||||
|
|
||||||
|
|
||||||
// memset, memcmp, memcpy, strncpy, fgets..
|
// memset, memcmp, memcpy, strncpy, fgets..
|
||||||
if (varid == 0)
|
if (varid == 0 && size > 0)
|
||||||
{
|
{
|
||||||
ArrayInfo arrayInfo(0U, varnames, total_size / size, size);
|
ArrayInfo arrayInfo(0U, varnames, total_size / size, size);
|
||||||
if (Token::Match(tok, ("%var% ( " + varnames + " ,").c_str()))
|
if (Token::Match(tok, ("%var% ( " + varnames + " ,").c_str()))
|
||||||
|
|
|
@ -1036,6 +1036,15 @@ private:
|
||||||
" x(obj.delay, 123);\n"
|
" x(obj.delay, 123);\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("[test.cpp:11] -> [test.cpp:6]: (error) Array 'obj . delay[3]' index 4 out of bounds\n", errout.str());
|
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()
|
void array_index_multidim()
|
||||||
|
|
Loading…
Reference in New Issue