diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-02-27 08:34:51 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-02-27 08:34:51 +0000 |
commit | 09597b461d806e7853aee6506a7bb5303dd5f24c (patch) | |
tree | b1bc4b460bb64b00ecdaa2d8c9f1ea4dccf39cdb /clang/lib/Sema/SemaChecking.cpp | |
parent | fb2a0f20dde751e87e987272d7b0ceb398182e3f (diff) | |
download | bcm5719-llvm-09597b461d806e7853aee6506a7bb5303dd5f24c.tar.gz bcm5719-llvm-09597b461d806e7853aee6506a7bb5303dd5f24c.zip |
Fix crasher caused by setting a bit in a possibly empty bitvector while
doing printf format string checking. This is a recent regression.
llvm-svn: 97318
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 7198dad5339..c7b9cb7b9be 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -1283,7 +1283,12 @@ CheckPrintfHandler::HandleFormatSpecifier(const analyze_printf::FormatSpecifier // Consume the argument. unsigned argIndex = FS.getArgIndex(); - CoveredArgs.set(argIndex); + if (argIndex < NumDataArgs) { + // The check to see if the argIndex is valid will come later. + // We set the bit here because we may exit early from this + // function if we encounter some other error. + CoveredArgs.set(argIndex); + } // Check for using an Objective-C specific conversion specifier // in a non-ObjC literal. |