This is an archive of the discontinued LLVM Phabricator instance.

Do not warn about format strings that are indexed string literals.
ClosedPublic

Authored by meikeb on Sep 14 2016, 2:25 PM.

Details

Summary

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

Patch by Meike Baumgärtner (meikeb)

Diff Detail

Repository
rL LLVM

Event Timeline

meikeb updated this revision to Diff 71435.Sep 14 2016, 2:25 PM
meikeb retitled this revision from to Do not warn about format strings that are indexed string literals..
meikeb updated this object.
meikeb added a reviewer: rsmith.
meikeb added subscribers: cfe-commits, srhines.

This is the same as D23820 besides that I added myself in the commit message as "Patch by". D23820 was reverted in D24579 because srhines' commit took authorship of this patch.

meikeb updated this revision to Diff 71438.Sep 14 2016, 2:31 PM

Fix typos in commit message.

meikeb updated this object.Sep 14 2016, 2:34 PM
rsmith accepted this revision.Sep 15 2016, 4:39 PM
rsmith edited edge metadata.
This revision is now accepted and ready to land.Sep 15 2016, 4:39 PM
meikeb updated this revision to Diff 71581.Sep 15 2016, 5:53 PM
meikeb edited edge metadata.

Rebase to current commit.

meikeb updated this revision to Diff 71583.Sep 15 2016, 6:03 PM

Try to drop randomly uploaded commit.

This revision was automatically updated to reflect the committed changes.