[PATCH] D63000: [ADT] Fix asan-detected stack-buffer-overflow in StringSetTest.cpp
Mike Pozulp via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 7 02:08:28 PDT 2019
mmpozulp created this revision.
mmpozulp added reviewers: aaron.ballman, dblaikie.
Herald added subscribers: llvm-commits, dexonsmith.
Herald added a project: LLVM.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D63000
Files:
llvm/unittests/ADT/StringSetTest.cpp
Index: llvm/unittests/ADT/StringSetTest.cpp
===================================================================
--- llvm/unittests/ADT/StringSetTest.cpp
+++ llvm/unittests/ADT/StringSetTest.cpp
@@ -33,11 +33,12 @@
// Test insert(StringMapEntry) and count(StringMapEntry)
// which are required for set_difference(StringSet, StringSet).
StringSet<> Set;
- StringMapEntry<StringRef> Element(1, "A");
- Set.insert(Element);
- size_t Count = Set.count(Element);
+ StringMapEntry<StringRef> *Element = StringMapEntry<StringRef>::Create("A");
+ Set.insert(*Element);
+ size_t Count = Set.count(*Element);
size_t Expected = 1;
EXPECT_EQ(Expected, Count);
+ Element->Destroy();
}
} // end anonymous namespace
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63000.203516.patch
Type: text/x-patch
Size: 726 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190607/59d648bc/attachment.bin>
More information about the llvm-commits
mailing list