MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / negativeArraySizeError

Method negativeArraySizeError

lib/checkbufferoverrun.cpp:1201–1208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1199}
1200
1201void CheckBufferOverrunImpl::negativeArraySizeError(const Token* tok)
1202{
1203 const std::string arrayName = tok ? tok->expressionString() : std::string();
1204 const std::string line1 = arrayName.empty() ? std::string() : ("$symbol:" + arrayName + '\n');
1205 reportError(tok, Severity::error, "negativeArraySize",
1206 line1 +
1207 "Declaration of array '" + arrayName + "' with negative size is undefined behaviour", CWE758, Certainty::normal);
1208}
1209
1210void CheckBufferOverrunImpl::negativeMemoryAllocationSizeError(const Token* tok, const ValueFlow::Value* value)
1211{

Callers 1

getErrorMessagesMethod · 0.80

Calls 3

reportErrorFunction · 0.70
expressionStringMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected