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

Method negativeMemoryAllocationSizeError

lib/checkbufferoverrun.cpp:1210–1217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1208}
1209
1210void CheckBufferOverrunImpl::negativeMemoryAllocationSizeError(const Token* tok, const ValueFlow::Value* value)
1211{
1212 const std::string msg = "Memory allocation size is negative.";
1213 ErrorPath errorPath = getErrorPath(tok, value, msg);
1214 const bool inconclusive = value != nullptr && !value->isKnown();
1215 reportError(std::move(errorPath), inconclusive ? Severity::warning : Severity::error, "negativeMemoryAllocationSize",
1216 msg, CWE131, inconclusive ? Certainty::inconclusive : Certainty::normal);
1217}
1218
1219void CheckBufferOverrun::runChecks(const Tokenizer &tokenizer, ErrorLogger& errorLogger)
1220{

Callers 1

getErrorMessagesMethod · 0.45

Calls 2

isKnownMethod · 0.80
reportErrorFunction · 0.70

Tested by

no test coverage detected