forked from OSchip/llvm-project
Fix <rdar://problem/6880975> [format string] Assertion failed: (Arg < NumArgs && "Arg access out of range!").
For format string checking, only check the type of the format specifier for non-vararg functions. llvm-svn: 71672
This commit is contained in:
parent
4a71ae268b
commit
4554f9b134
|
@ -917,7 +917,8 @@ void Sema::CheckPrintfString(const StringLiteral *FExpr,
|
|||
case '*': {
|
||||
++numConversions;
|
||||
|
||||
if (!HasVAListArg && numConversions > numDataArgs) {
|
||||
if (!HasVAListArg) {
|
||||
if (numConversions > numDataArgs) {
|
||||
SourceLocation Loc = getLocationOfStringLiteralByte(FExpr, StrIdx);
|
||||
|
||||
if (Str[StrIdx-1] == '.')
|
||||
|
@ -948,6 +949,7 @@ void Sema::CheckPrintfString(const StringLiteral *FExpr,
|
|||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Characters which can terminate a format conversion
|
||||
// (e.g. "%d"). Characters that specify length modifiers or
|
||||
|
|
|
@ -125,3 +125,8 @@ void test9(char *P) {
|
|||
printf(P, 42);
|
||||
printf("%n", &x); // expected-warning {{use of '%n' in format string discouraged }}
|
||||
}
|
||||
|
||||
void torture(va_list v8) {
|
||||
vprintf ("%*.*d", v8); // no-warning
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue