parent
9e09ccca86
commit
68acd77053
|
@ -357,7 +357,7 @@ CTU::FileInfo *CTU::getFileInfo(const Tokenizer *tokenizer)
|
||||||
fileInfo->functionCalls.push_back(std::move(functionCall));
|
fileInfo->functionCalls.push_back(std::move(functionCall));
|
||||||
}
|
}
|
||||||
// array
|
// array
|
||||||
if (argtok->variable() && argtok->variable()->isArray() && argtok->variable()->dimensions().size() == 1) {
|
if (argtok->variable() && argtok->variable()->isArray() && argtok->variable()->dimensions().size() == 1 && argtok->variable()->dimensionKnown(0)) {
|
||||||
FileInfo::FunctionCall functionCall;
|
FileInfo::FunctionCall functionCall;
|
||||||
functionCall.callValueType = ValueFlow::Value::ValueType::BUFFER_SIZE;
|
functionCall.callValueType = ValueFlow::Value::ValueType::BUFFER_SIZE;
|
||||||
functionCall.callId = getFunctionId(tokenizer, tokFunction);
|
functionCall.callId = getFunctionId(tokenizer, tokFunction);
|
||||||
|
|
|
@ -5213,6 +5213,15 @@ private:
|
||||||
" dostuff(x);\n"
|
" dostuff(x);\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("[test.cpp:4] -> [test.cpp:1]: (error) Pointer arithmetic overflow; 'p' buffer size is 12\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:4] -> [test.cpp:1]: (error) Pointer arithmetic overflow; 'p' buffer size is 12\n", errout.str());
|
||||||
|
|
||||||
|
ctu("void f(const char *p) {\n" // #11361
|
||||||
|
" const char* c = p + 1;\n"
|
||||||
|
"}\n"
|
||||||
|
"void g() {\n"
|
||||||
|
" const char s[N] = \"ab\";\n"
|
||||||
|
" f(s);\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void objectIndex() {
|
void objectIndex() {
|
||||||
|
|
Loading…
Reference in New Issue