Skip to content

Commit

Permalink
Revert "[DebugInfo] Fix detection of hash collision in Apple Accel ta…
Browse files Browse the repository at this point in the history
…bles"

Committed a slightly older patch without the proper link to the review.

This reverts commit 42874f6.
  • Loading branch information
felipepiovezan committed Jun 15, 2023
1 parent 42874f6 commit 0f11a5f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 46 deletions.
23 changes: 13 additions & 10 deletions llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,19 +333,22 @@ AppleAcceleratorTable::equal_range(StringRef Key) const {
return EmptyRange;

std::optional<uint32_t> StrOffset = readStringOffsetAt(DataOffset);
// Valid input and still have strings in this hash.
while (StrOffset && *StrOffset) {
std::optional<StringRef> MaybeStr = readStringFromStrSection(*StrOffset);
std::optional<uint32_t> NumEntries = this->readU32FromAccel(DataOffset);
if (!MaybeStr || !NumEntries)
return EmptyRange;

// Invalid input or no more strings in this hash.
if (!StrOffset || *StrOffset == 0)
return EmptyRange;

std::optional<StringRef> MaybeStr = readStringFromStrSection(*StrOffset);
std::optional<uint32_t> NumEntries = this->readU32FromAccel(DataOffset);
if (!MaybeStr || !NumEntries)
return EmptyRange;
if (Key == *MaybeStr) {
uint64_t EndOffset = DataOffset + *NumEntries * getHashDataEntryLength();
if (Key == *MaybeStr)
return make_range({*this, DataOffset}, ValueIterator{*this, EndOffset});
DataOffset = EndOffset;
StrOffset = readStringOffsetAt(DataOffset);
return make_range({*this, DataOffset}, ValueIterator{*this, EndOffset});
}

// FIXME: this shouldn't return, we haven't checked all the colliding strings
// in the bucket!
return EmptyRange;
}

Expand Down
36 changes: 0 additions & 36 deletions llvm/test/DebugInfo/Generic/apple-names-hash-collisions.ll

This file was deleted.

0 comments on commit 0f11a5f

Please sign in to comment.