Repository navigation
Conversation
…ZMAFile Null bytes in multiples of four after an .xz stream are now skipped, so that a stream following them is decoded instead of ignored.
Rename the shared stream option to xz_stream_padding (and the helpers to _skip_xz_padding and _xz_padding_size): no other format handled here has such padding, and the option needs stream_magic to be a bytes object. A run of null bytes after an .xz stream whose size is not a multiple of four is left to the decompressor, as before. DecompressReader no longer builds the whole run in memory to do that: it keeps the number of null bytes between the first and the last block it read, and hands them back in the blocks they were read in. _xz_padding_size() limits the size of the chunks it copies. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
gpshead
marked this pull request as ready for review
November 12, 2026 00:11
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.
lzma.decompress()andLZMAFilenow skip .xz stream padding (a run of null bytes whose size is a multiple of four) after a stream that starts with the .xz magic, and go on to decode the stream that follows; a damaged stream after the padding raises like any other damaged later stream. The skipping is done in the shared Python stream loop and turned on only bylzma, rather than withLZMA_CONCATENATEDin C, because that would need a new finish method onLZMADecompressorand would reject the mixed .xz/.lzma data thatFORMAT_AUTOdecodes today. A run of null bytes whose size is not a multiple of four is still handed to the decompressor as before, so nothing that decodes today starts to fail on that account, although the format specification says it is an error.FORMAT_ALONE,FORMAT_RAW,bz2andcompression.zstdare unchanged.Fixes #88300