forked from OSchip/llvm-project
Alternate format string checking: check if the number of format specifiers exceeds the number of arguments.
llvm-svn: 94785
This commit is contained in:
parent
559d89a02a
commit
9fcd8305c0
|
@ -1418,6 +1418,18 @@ CheckPrintfHandler::HandleFormatSpecifier(const analyze_printf::FormatSpecifier
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
// The remaining checks depend on the data arguments.
|
||||
if (HasVAListArg)
|
||||
return true;
|
||||
|
||||
if (NumConversions > NumDataArgs) {
|
||||
S.Diag(getLocationOfByte(CS.getStart()),
|
||||
diag::warn_printf_insufficient_data_args)
|
||||
<< getFormatRange();
|
||||
// Don't do any more checking.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue