Skip to content

Only read the PE header when verifying downloaded Windows installers - #330

Merged
FranzBusch merged 1 commit into
swiftlang:mainfrom
plemarquand:fix-installer-header-check-over-2gb
Oct 26, 2026
Merged

FranzBusch merged 1 commit into
swiftlang:mainfrom
plemarquand:fix-installer-header-check-over-2gb

Conversation

@plemarquand

Copy link
Copy Markdown
Contributor

The download check read the whole installer with ReadAllBytes just to look at the first two bytes. ReadAllBytes throws on files over 2 GB, and the nightly-main Windows toolchain installer is now 2087 MB, so every attempt fails with "The file is too long".

Open the file and read only the two-byte MZ header instead.

The download check read the whole installer with ReadAllBytes just to
look at the first two bytes. ReadAllBytes throws on files over 2 GB, and
the nightly-main Windows toolchain installer is now 2087 MB, so every
attempt fails with "The file is too long" and the Install Swift step
gives up after 5 retries.

Open the file and read only the two-byte MZ header instead. The same
check in install-vsb.ps1 gets the same fix.
@plemarquand
plemarquand requested a review from a team as a code owner October 26, 2026 15:48
@FranzBusch
FranzBusch merged commit 316af91 into swiftlang:main Oct 26, 2026
193 of 196 checks passed
@plemarquand
plemarquand deleted the fix-installer-header-check-over-2gb branch October 26, 2026 17:03
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.

2 participants