Fix compressed .vhd.zst image writes#2968
Draft
jaredhagel2 wants to merge 1 commit intopbatard:masterfrom
Draft
Conversation
080bb32 to
f3eb97d
Compare
f3eb97d to
525edb2
Compare
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.
Summary
Fix failures when writing Windows disk images stored as compressed fixed VHDs such as
.vhd.zst.Problem
When writing a compressed Windows image to a CFast card, Rufus could fail shortly after pressing START with a compressed-image write error.
The immediate write failure was caused by sector-sized writes reaching the physical device from decompressor buffers that were not sector-aligned. Some physical media accept sector-sized writes only when the source buffer is aligned as well, so the write path could fail even though the decompression itself was fine.
There was also a second issue specific to compressed fixed VHD payloads. Rufus could treat a
.vhd.zstimage like a generic compressed raw image and fall back to the compressed archive size instead of the decompressed disk payload size. That could cause the write path to stop at the archive size instead of the real end of the fixed VHD payload.Fix
This change:
Result
Compressed
.vhd.zstimages now write correctly to physical media that require aligned raw writes, and fixed-VHD payloads are written to their proper payload length instead of being cut off at the compressed archive size.