Ticket #6232 (cppOut of bounds array access)
--HG-- extra : rebase_source : 79ed3533a12a486ea3ed3f09f9bc55b1a4771161
This commit is contained in:
parent
dd6ade9831
commit
71c5d4bd60
|
@ -698,8 +698,8 @@ void CheckBufferOverrun::checkScope(const Token *tok, const std::vector<std::str
|
||||||
|
|
||||||
void CheckBufferOverrun::valueFlowCheckArrayIndex(const Token * const tok, const ArrayInfo &arrayInfo)
|
void CheckBufferOverrun::valueFlowCheckArrayIndex(const Token * const tok, const ArrayInfo &arrayInfo)
|
||||||
{
|
{
|
||||||
// Declaration in global scope?
|
// Declaration in global scope or namespace?
|
||||||
if (tok->scope()->type == Scope::eGlobal)
|
if (tok->scope()->type == Scope::eGlobal || tok->scope()->type == Scope::eNamespace)
|
||||||
return;
|
return;
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
|
|
|
@ -2130,6 +2130,10 @@ private:
|
||||||
check("class X { static const int x[100]; };\n" // #6070
|
check("class X { static const int x[100]; };\n" // #6070
|
||||||
"const int X::x[100] = {0};", false, "test.cpp", false);
|
"const int X::x[100] = {0};", false, "test.cpp", false);
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
check("namespace { class X { static const int x[100]; };\n" // #6232
|
||||||
|
"const int X::x[100] = {0}; }", false, "test.cpp", false);
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void buffer_overrun_1_posix_functions() {
|
void buffer_overrun_1_posix_functions() {
|
||||||
|
|
Loading…
Reference in New Issue