Preserve all signed PE files when stripping releases - #1305
Open
mrmathematica wants to merge 1 commit into
Open
mrmathematica wants to merge 1 commit into
mrmathematica wants to merge 1 commit into
Conversation
llvm-strip removes Authenticode certificate data from PE files without
clearing the IMAGE_DIRECTORY_ENTRY_SECURITY entry. The resulting
certificate table points beyond EOF, producing a malformed binary that
signtool rejects with 0x800700C1 ("%1 is not a valid Win32
application").
Previous fixes in astral-sh#856 and astral-sh#1217 avoided this for known DLL filenames.
However, the list is incomplete: signed zlib1.dll files can exhibit the
same corruption, and future dependency changes could introduce more
affected filenames.
Replace the signed-DLL filename list with PE header inspection. Skip
llvm-strip whenever the input has a non-empty certificate table whose
file-offset range is within the file. Continue preserving Tcl 9 DLLs
separately because their embedded ZIPFS data must not be stripped.
Add tests covering:
- signed PE32 and PE32+ files with in-bounds certificate tables;
- unsigned and malformed files, which remain eligible for stripping;
- Tcl 9 DLLs containing ZIPFS data.
This is a durable follow-up to issue astral-sh#855 and PRs astral-sh#856 and astral-sh#1217,
without requiring every signed DLL to be identified in advance.
Contributor
|
Thanks for putting this together. I'm out this week but will give this a review when I am back. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
llvm-strip removes Authenticode certificate data from PE files without clearing the IMAGE_DIRECTORY_ENTRY_SECURITY entry. The resulting certificate table points beyond EOF, producing a malformed binary that signtool rejects with 0x800700C1 ("%1 is not a valid Win32 application").
Previous fixes in #856 and #1217 avoided this for known DLL filenames. However, the list is incomplete: signed zlib1.dll files can exhibit the same corruption, and future dependency changes could introduce more affected filenames.
Replace the signed-DLL filename list with PE header inspection. Skip llvm-strip whenever the input has a non-empty certificate table whose file-offset range is within the file. Continue preserving Tcl 9 DLLs separately because their embedded ZIPFS data must not be stripped.
Add tests covering:
This is a durable follow-up to issue #855 and PRs #856 and #1217, without requiring every signed DLL to be identified in advance.