Skip to content

Commit

Permalink
Add check that the typelib customattribute parent points to Assembly …
Browse files Browse the repository at this point in the history
…table to ignore random GUIDs
  • Loading branch information
HoundThe authored and PeterMatula committed Jul 16, 2021
1 parent 5e73460 commit 6711d05
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/fileformat/file_format/pe/pe_format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2433,6 +2433,14 @@ void PeFormat::detectTypeLibId()
for (std::size_t i = 1; i <= customAttributeTable->getNumberOfRows(); ++i)
{
auto customAttributeRow = customAttributeTable->getRow(i);

// Check that the parent is index into Assembly table
MetadataTableType parent_table;
if (customAttributeRow->parent.getTable(parent_table) && parent_table != MetadataTableType::Assembly)
{
continue;
}

if (customAttributeRow->type.getIndex() == guidMemberRef)
{
// Its value is the TypeLib we are looking for
Expand Down

0 comments on commit 6711d05

Please sign in to comment.