Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pecoff signing with post-header gap and unaligned last section #50

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

fryshorts
Copy link

@fryshorts fryshorts commented Feb 11, 2025

When attempting to sign one of our binaries, we ran into two separate issues. The binary has two unusual features:

  1. There is a "gap" between the file header and the start of the first section
  2. The last section is not padded to the aligned size

The proposed changes fix the signing (and verification) for our binary.

Some compilers (e.g. Delphi) may produce output where the last section
is not padded at all.

This change will prevent the recalculation of SizeOfRawData for the
last section. In case the compiler does add a padding, we will read it
in the "readTrailer" function.

Signed-off-by: Leonhard Oelke <leonhard@in-verted.de>
It is possible for binaries to have a "gap" between the PE header and
the start of the first section. This change will handle those files by
digesting the "gap".

Signed-off-by: Leonhard Oelke <leonhard@in-verted.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant