diff --git a/cfg/std.cfg b/cfg/std.cfg index 4572ab6f6..856c70789 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -3753,11 +3753,12 @@ false - + + 1: @@ -3765,9 +3766,6 @@ - - - diff --git a/lib/library.cpp b/lib/library.cpp index 690888249..aefc238db 100644 --- a/lib/library.cpp +++ b/lib/library.cpp @@ -683,6 +683,20 @@ static std::string functionName(const Token *ftok) return ret; } +bool Library::isuninitargbad(const Token *ftok, int argnr) const +{ + const ArgumentChecks *arg = getarg(ftok, argnr); + if (!arg) { + // non-scan format string argument should not be uninitialized + const std::string funcname = functionName(ftok); + std::map >::const_iterator it = _formatstr.find(funcname); + if (it != _formatstr.end() && !it->second.first) + return true; + } + return arg && arg->notuninit; +} + + /** get allocation id for function */ int Library::alloc(const Token *tok) const { diff --git a/lib/library.h b/lib/library.h index 83b86b2b2..325fcd959 100644 --- a/lib/library.h +++ b/lib/library.h @@ -217,10 +217,7 @@ public: return arg && arg->notnull; } - bool isuninitargbad(const Token *ftok, int argnr) const { - const ArgumentChecks *arg = getarg(ftok, argnr); - return arg && arg->notuninit; - } + bool isuninitargbad(const Token *ftok, int argnr) const; bool isargformatstr(const Token *ftok, int argnr) const { const ArgumentChecks *arg = getarg(ftok, argnr);