Skip to content

Commit 71ce952

Browse files
committed
Review feedback
1 parent 159091e commit 71ce952

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

llvm/unittests/IR/IntrinsicsTest.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ TEST(IntrinsicNameLookup, NonNullterminatedStringRef) {
9696
// Make an intrinsic name "llvm.memcpy.inline" on the heap.
9797
std::string Name = "llvm.memcpy.inline";
9898
assert(Name.size() == 18);
99+
// Create a StringRef backed by heap allocated memory such that OOB access
100+
// in that StringRef can be flagged by asan. Here, the String `S` is of size
101+
// 18, and backed by a heap allocated buffer `Data`, so access to S[18] will
102+
// be flagged bby asan.
99103
std::unique_ptr<char[]> Data = std::make_unique<char[]>(Name.size());
100104
std::strncpy(Data.get(), Name.data(), Name.size());
101105
StringRef S(Data.get(), Name.size());

0 commit comments

Comments
 (0)