Skip to content

Commit 073335d

Browse files
[CAS] Fix msan failure attempt 2 (#164493)
Try to fix msan error again. Previously, the error wasn't correctly identified as the uninitialized value is in a different function than the line crashed. Make sure value return from hash generating function is fully zero initialized.
1 parent 0e8ee0e commit 073335d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

llvm/unittests/CAS/OnDiskCommonUtils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ inline HashType digest(StringRef Data) {
4545
}
4646

4747
inline ValueType valueFromString(StringRef S) {
48-
ValueType Val;
48+
ValueType Val = {};
4949
llvm::copy(S.substr(0, sizeof(Val)), Val.data());
5050
return Val;
5151
}

llvm/unittests/CAS/OnDiskKeyValueDBTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ TEST_F(OnDiskCASTest, OnDiskKeyValueDBTest) {
6565
// Insert a lot of entries.
6666
for (unsigned I = 0; I < 1024 * 100; ++I) {
6767
std::string Index = Twine(I).str();
68-
ArrayRef<char> Val;
68+
std::optional<ArrayRef<char>> Val;
6969
ASSERT_THAT_ERROR(
7070
DB->put(digest(Index), valueFromString(Index)).moveInto(Val),
7171
Succeeded());

0 commit comments

Comments
 (0)