Skip to content

Commit

Permalink
Merge pull request avast#996 from avast/LZ_RETDEC_73
Browse files Browse the repository at this point in the history
COFF debug info is no longer counted as part of the image
  • Loading branch information
metthal authored Aug 5, 2021
2 parents a192dc2 + 317b2b7 commit 18b434f
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/fileformat/file_format/pe/pe_format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2781,14 +2781,9 @@ bool PeFormat::hasMixedEndianForDouble() const
*/
std::size_t PeFormat::getDeclaredFileLength() const
{
std::size_t declSize = FileFormat::getDeclaredFileLength();
if(getNumberOfCoffSymbols() && getCoffSymbolTableOffset())
{
const std::size_t symTabMaxOffset = getCoffSymbolTableOffset() + (getNumberOfCoffSymbols() * PELIB_IMAGE_SIZEOF_COFF_SYMBOL);
declSize = std::max(declSize, symTabMaxOffset);
}

return declSize + getSizeOfStringTable();
// LZ: Do not include COFF symbol table in the declared file length;
// This is because other PE tools (for example YARA) don't do that either.
return FileFormat::getDeclaredFileLength();
}

bool PeFormat::areSectionsValid() const
Expand Down

0 comments on commit 18b434f

Please sign in to comment.