Fixed #2096 (False positive: buffer overrun (extern array))
This commit is contained in:
parent
267d1f273e
commit
b6c995ea47
|
@ -1794,7 +1794,9 @@ bool CheckBufferOverrun::ArrayInfo::declare(const Token *tok, const Tokenizer &t
|
||||||
if (!tok->isName())
|
if (!tok->isName())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
while (tok && (tok->str() == "static" || tok->str() == "const"))
|
while (tok && (tok->str() == "static" ||
|
||||||
|
tok->str() == "const" ||
|
||||||
|
tok->str() == "extern"))
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
|
|
||||||
int ivar = 0;
|
int ivar = 0;
|
||||||
|
|
|
@ -1700,6 +1700,13 @@ private:
|
||||||
" strcpy(x, \"12\");\n"
|
" strcpy(x, \"12\");\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
check("extern char a[10];\n"
|
||||||
|
"void f() {\n"
|
||||||
|
" char b[25] = {0};\n"
|
||||||
|
" std::memcpy(b, a, sizeof(a));\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void sprintf1()
|
void sprintf1()
|
||||||
|
|
Loading…
Reference in New Issue