[PATCH] D41384: [analyzer] Suppress false positive warnings form security.insecureAPI.strcpy
Devin Coughlin via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 21 14:20:00 PST 2018
dcoughlin added inline comments.
================
Comment at: cfe/trunk/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp:517
+ if (const auto *Array = dyn_cast<ConstantArrayType>(DeclRef->getType())) {
+ uint64_t ArraySize = BR.getContext().getTypeSize(Array) / 8;
+ if (const auto *String = dyn_cast<StringLiteral>(Source)) {
----------------
Rather than dividing by '8', I suggest using ASTContext's getTypeSizeInChars(). This will make sure we handle those annoying platforms that don't have 8-bit chars.
Repository:
rL LLVM
https://reviews.llvm.org/D41384
More information about the cfe-commits
mailing list