[PATCH] D150254: [tidy] Fix possible use-after-free in IdentifierNamingCheck
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 10 00:52:14 PDT 2023
kadircet created this revision.
kadircet added reviewers: hokein, PiotrZSL.
Herald added a subscriber: carlosgalvezp.
Herald added a reviewer: njames93.
Herald added a project: All.
kadircet requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.
CheckName retrieived during construction is a reference to keys stored
inside ClangTidyCheckFactories, which isn't guranteed to outlive the check.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D150254
Files:
clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h
Index: clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h
===================================================================
--- clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h
+++ clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h
@@ -11,6 +11,7 @@
#include "../utils/RenamerClangTidyCheck.h"
#include <optional>
+#include <string>
namespace clang::tidy {
namespace readability {
@@ -202,7 +203,7 @@
mutable llvm::StringMap<FileStyle> NamingStylesCache;
FileStyle *MainFileStyle;
ClangTidyContext *Context;
- const StringRef CheckName;
+ const std::string CheckName;
const bool GetConfigPerFile;
const bool IgnoreFailedSplit;
HungarianNotation HungarianNotation;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150254.520926.patch
Type: text/x-patch
Size: 738 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230510/d6e5b9d8/attachment.bin>
More information about the cfe-commits
mailing list