diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-02-24 23:03:04 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-02-24 23:03:04 +0000 |
commit | b43e8ad893706a2499c4901b8f5cb289553d66b1 (patch) | |
tree | edb911fa26449bdb18181492770993e347774a47 /lib/Sema/SemaChecking.cpp | |
parent | 65d39251ff57b8e33cf6d3a7fcc6aa1c6f8cdc68 (diff) |
Don't warn about using PredefinedExprs as format string literals. These never can be a real security issue.
Fixes PR 9314.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126447 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaChecking.cpp')
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index 5c2356f54d..97cc44e737 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -875,7 +875,7 @@ bool Sema::SemaBuiltinLongjmp(CallExpr *TheCall) { return false; } -// Handle i > 1 ? "x" : "y", recursivelly +// Handle i > 1 ? "x" : "y", recursively. bool Sema::SemaCheckStringLiteral(const Expr *E, const CallExpr *TheCall, bool HasVAListArg, unsigned format_idx, unsigned firstDataArg, @@ -918,6 +918,12 @@ bool Sema::SemaCheckStringLiteral(const Expr *E, const CallExpr *TheCall, } return false; + case Stmt::PredefinedExprClass: + // While __func__, etc., are technically not string literals, they + // cannot contain format specifiers and thus are not a security + // liability. + return true; + case Stmt::DeclRefExprClass: { const DeclRefExpr *DR = cast<DeclRefExpr>(E); |