Repository navigation
Apply --memory to .xz and .lzma decompression - #4903
Merged
Merged
Conversation
--memory (128 MiB by default) only limited the decompression of zstd frames: liblzma was initialized without any limit. Pass it to liblzma as well. When a file needs more, report how much memory it needs and suggest a --memory= value, as for zstd frames. .xz and .lzma files that need more than 128 MiB to decode now require --memory=, like zstd frames with a large window.
Cyan4973
force-pushed
the
cli-lzma-memlimit
branch
from
November 7, 2026 05:52
f40d782 to
b276bea
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.
--memory(128 MiB by default) limits the memory used to decompress zstd frames, but it has never applied to.xzand.lzmainput: liblzma was initialized without a limit.This PR passes the limit to liblzma as well. When a file needs more,
zstdreports how much memory it needs and suggests a--memory=value, as it already does for zstd frames:Behavior change:
.xzand.lzmafiles that need more than 128 MiB to decode now require--memory=, like zstd frames with a large window. Files made with thexzpresets are not affected: the largest preset (-9,-9e) uses a 64 MiB dictionary and needs 65 MiB to decode.The man page now says that
--memoryalso applies to.xzand.lzma.Tests
playTests.sh:.xzand.lzmafiles with a 4 MiB dictionary are rejected with--memory=1MB. The message suggests--memory=5MB, and that value is then accepted.playTests.shand thecli-testspass. The build also passes with gcc and clang (-Werror) and without liblzma.