[PATCH] D111833: [clang] Fortify warning for scanf calls with field width too big.
George Burgess IV via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 20 14:15:14 PDT 2021
george.burgess.iv accepted this revision.
george.burgess.iv added a comment.
LGTM. Thanks again!
================
Comment at: clang/lib/Sema/SemaChecking.cpp:735
+
+ auto *FormatExpr = TheCall->getArg(FormatIndex)->IgnoreParenImpCasts();
+
----------------
nit: const auto if possible (and below)
================
Comment at: clang/lib/Sema/SemaChecking.cpp:756
+ ScanfDiagnosticFormatHandler H(
+ [&](unsigned Index) { return ComputeSizeArgument(Index + DataIndex); },
+ Diagnose);
----------------
Please put this in a variable and pass that into `H`'s constructor. `function_ref` doesn't own the function it points to, so any use of this at line >= 758 (e.g., line 768) is a use-after-free.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D111833/new/
https://reviews.llvm.org/D111833
More information about the cfe-commits
mailing list