diff --git a/src/checkbufferoverrun.cpp b/src/checkbufferoverrun.cpp index 6e40a0971..a36cc30b6 100644 --- a/src/checkbufferoverrun.cpp +++ b/src/checkbufferoverrun.cpp @@ -608,7 +608,7 @@ void CheckBufferOverrunClass::STLSizeProblems() if (Token::Match(tok, pattern.c_str())) { - _errorLogger->outOfBounds(_tokenizer, tok, "When " + num->str() + " == size(), " + pattern); + _errorLogger->stlOutOfBounds(_tokenizer, tok, "When " + num->str() + " == size(), " + pattern); } tok = tok->next(); diff --git a/src/errorlogger.h b/src/errorlogger.h index a5a6cb96d..be91b4776 100644 --- a/src/errorlogger.h +++ b/src/errorlogger.h @@ -95,6 +95,15 @@ public: return true; } + void stlOutOfBounds(const Tokenizer *tokenizer, const Token *Location, const std::string &what) + { + _writemsg(tokenizer, Location, "error", "" + what + " is out of bounds", "stlOutOfBounds"); + } + static bool stlOutOfBounds() + { + return true; + } + void noConstructor(const Tokenizer *tokenizer, const Token *Location, const std::string &classname) { _writemsg(tokenizer, Location, "style", "The class '" + classname + "' has no constructor", "noConstructor"); diff --git a/tools/errmsg.cpp b/tools/errmsg.cpp index 4b81a3f78..b8c2f868f 100644 --- a/tools/errmsg.cpp +++ b/tools/errmsg.cpp @@ -61,6 +61,7 @@ int main() err.push_back(Message("arrayIndexOutOfBounds", Message::all, "Array index out of bounds")); err.push_back(Message("bufferOverrun", Message::all, "Buffer overrun")); err.push_back(Message("outOfBounds", Message::error, "%1 is out of bounds", "what")); + err.push_back(Message("stlOutOfBounds", Message::error, "%1 is out of bounds", "what")); // checkclass.cpp.. err.push_back(Message("noConstructor", Message::style, "The class '%1' has no constructor", "classname"));