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 | e3fc54790250076e33ad25b14e5be293514fe5ea (patch) | |
tree | 018687ffe4c2b9251df2b6217ca1c5251670faad /lib/Sema/SemaChecking.cpp | |
parent | dab10acd5642b7319dd586922728c528c47d3b30 (diff) |
Fix crasher caused by setting a bit in a possibly empty bitvector while
doing printf format string checking. This is a recent regression.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97318 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaChecking.cpp')
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index 7198dad533..c7b9cb7b9b 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/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. |