[PATCH] D71566: New checks for fortified sprintf
serge via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 16 13:21:43 PST 2019
serge-sans-paille created this revision.
serge-sans-paille added a reviewer: erik.pilkington.
serge-sans-paille added a project: clang.
Herald added subscribers: cfe-commits, dexonsmith.
Implement a pessimistic evaluator of the minimal required size for a buffer based on the format string, and couple that with the fortified version to emit a warning when the buffer size is lower than the lower bound computed from the format string.
See the test cases for examples of warnings, and https://github.com/serge-sans-paille/llvm-project/pull/6/checks for the cross-platform validation.
Note: The lower bound could be improved, but I'd rather do that in an incremental commit, if that's okay with the reviewers.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D71566
Files:
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaChecking.cpp
clang/test/Sema/warn-fortify-source.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71566.234127.patch
Type: text/x-patch
Size: 7371 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191216/02b2fc18/attachment-0001.bin>
More information about the cfe-commits
mailing list