]> granicus.if.org Git - clang/commit
Do not warn about format strings that are indexed string literals.
authorStephen Hines <srhines@google.com>
Wed, 14 Sep 2016 20:05:20 +0000 (20:05 +0000)
committerStephen Hines <srhines@google.com>
Wed, 14 Sep 2016 20:05:20 +0000 (20:05 +0000)
commit562918ea45f8748e25fefbdb43b548b8ccd8d7d9
tree9af931cd54cd7af3f7b7d1aa1d2a81adfacf16a6
parent2da0fd17d34c97f5057bbd074a466987e63a1b97
Do not warn about format strings that are indexed string literals.

Summary:
The warning for a format string not being a sting literal and therefore
being potentially insecure is overly strict for indecies into sting
literals. This fix checks if the index into the string literal is
precomputable. If thats the case it will check if the suffix of that
sting literal is a valid format string string literal. It will still
issue the aforementioned warning for out of range indecies into the
string literal.

Reviewers: rsmith

Subscribers: srhines, cfe-commits

Differential Revision: https://reviews.llvm.org/D23820

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281527 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaChecking.cpp
test/Sema/format-strings.c