IMPORTANT: This includes security fixes. These and a few other fixes have also been committed to the old stable branches (v5.2, v5.4, and v5.6) in the xz Git repository. Those fixes are marked below. No new 5.2.x, 5.4.x, or 5.6.x releases will be made.
5.8.5 (2026-12-03)
* liblzma:
- Fix a data corruption bug in the LZMA2 encoder. The issue was
found via code analysis; no one has reported actual data
corruption. Creating a test file to trigger this bug isn't
straightforward, and at the time of this release, no such
files are known.
If the bug is triggered in a debug build, an assertion will
fail. In non-debug builds, a corrupt file is created. It
should usually be recoverable if one knows that the corruption
is due to this bug.
If the dictionary size is smaller than 64 KiB (uncommon) and
some extra conditions are met, triggering the bug can result
in memory reads a few bytes before the beginning of an array.
In this case, if the encoder doesn't crash, the resulting
corrupt file won't be recoverable.
The bug is specific to liblzma; it wasn't inherited from
LZMA SDK, and XZ for Java has done this detail differently
from the beginning.
This is tracked as GHSA-vhhh-g38j-pr8q.
The bug was reported by Vladimir Kukharenko (GenProof).
(Also in v5.2, v5.4, and v5.6.)
- Fix data corruption or deadlock in the x86 BCJ filter when
the buffer passed to the filter function exceeds 4 GiB and
contains appropriate input data. Apps, that use smaller
buffers to process large files, aren't affected. The code
was revised, and the new code is both simpler and faster.
This is tracked as GHSA-6237-3fq8-r2hg.
The bug was reported by Vladimir Kukharenko (GenProof).
(Also in v5.2, v5.4, and v5.6.)
- Fix reinitialization bugs in lzma_stream_encoder_mt():
* Reinitialization with different lzma_mt.block_size could
result in a buffer overflow. It should crash easily, yet
this bug wasn't found until now. So it seems that few
applications can trigger it. For example, xz cannot.
* If the encoder was reinitialized in some other situation
than after lzma_code() has returned LZMA_STREAM_END, the
reinitialized encoder could corrupt data, deadlock, or
show wrong progress indicator information. In xz this was
possible after memory allocation failure or I/O error.
These are tracked as GHSA-jvh7-x64f-69mg.
The bugs were reported by Mar.
(Also in v5.2, v5.4, and v5.6.)
- lzma_alone_decoder() and lzma_raw_decoder() with
LZMA_FILTER_LZMA1EXT: Fix detection of an optional LZMA
end marker. Decoding failed with LZMA_DATA_ERROR if all input
bytes needed to decode the end marker weren't provided in the
same lzma_code() call. That is, the failure depended how the
input file was split into chunks by an application.
(Also in v5.2, v5.4, and v5.6.)
- lzma_stream_decoder_mt():
* Fix a double free if a mutex or condition variable
initialization failed.
* Fix a mutex and condition variable leak on lzma_end().
* Fix lzma_memusage() after lzma_code() has returned
LZMA_MEMLIMIT_ERROR. The reported memory usage requirement
was too low (usually 32 KiB). Increasing the limit to that
value with lzma_memlimit_set() incorrectly succeeded, but
lzma_code() still returned LZMA_MEMLIMIT_ERROR and
decoding couldn't be continued.
(Also in v5.4 and v5.6.)
- Fixes that affect lzma_memusage(), lzma_memlimit_get(), and
lzma_memlimit_set() when used with specific decoders:
* lzma_stream_decoder(), lzma_alone_decoder(), and
lzma_lzip_decoder(): After decoder reinitialization,
include the still-allocated cached memory from the
previous decoder instance in the current memory usage.
lzma_auto_decoder() and lzma_stream_decoder_mt() already
did this.
* lzma_auto_decoder(): After decoder reinitialization with
a different memory usage limit, make lzma_memlimit_get()
return the current limit, not the previous limit. In
debug builds, fix a related assertion failure, which also
occurred with lzma_memusage() and lzma_memlimit_set().
- lzma_stream_decoder(), lzma_stream_decoder_mt(),
lzma_alone_decoder(), lzma_auto_decoder(), and
lzma_lzip_decoder(): On reinitialization, free the old cached
decoder if its memory usage is higher than the new memory
usage limit.
- Set lzma_stream.total_in and .total_out to 0 even if a coder
initialization fails. This matches the API docs, but it's
unlikely that anything actually cares about these counters
after an initialization error.
(Also in v5.2, v5.4, and v5.6.)
- lzma_easy_encoder(): If called with an unsupported preset,
free the previous coder (if any) to avoid a memory leak.
(Also in v5.2, v5.4, and v5.6.)
- lzma_easy_encoder_memusage() and lzma_easy_decoder_memusage():
On error (invalid or unsupported preset), return UINT64_MAX as
documented instead of UINT32_MAX.
(Also in v5.2, v5.4, and v5.6.)
- lzma_get_progress(): Don't crash if no coder is initialized
in the lzma_stream argument.
(Also in v5.2, v5.4, and v5.6.)
- lzma_index_append(): Fix a possible integer overflow if the
function is called on a concatenated lzma_index (created using
lzma_index_cat()). It's valid use of the API, but there is no
known use case where an application might want to do this.
(Also in v5.2, v5.4, and v5.6.)
- LZMA/LZMA2 encoder: Silence Valgrind and -fsanitize=memory if
a preset dictionary is used (a raw encoder only feature).
A few bytes of uninitialized memory was read, but those bytes
were eventually ignored, so the code still worked correctly.
(Also in v5.2, v5.4, and v5.6.)
- Improve LZMA/LZMA2 encoder speed by prefetching hash table
entries with __builtin_prefetch(). The benefit depends on
the computer, input file, and compression settings.
- Linux: Make lzma_physmem() and lzma_cputhreads() look at
cgroup v2 memory.max and cpu.max, and use the .max values
when they are lower than the physical hardware resources.
This makes it much less likely that OOM killer will send
SIGKILL to xz (or any other app that uses these functions to
estimate available resources) when running in a container that
uses these cgroup v2 limits.
NOTE: In some distros, one might need to update SELinux
policies for applications that call lzma_physmem() or
lzma_cputhreads() because now these functions try to read
files from the /sys/fs/cgroup tree.
* xz: Fix EINTR handling in --files and --files0. If reading a
filename blocked and a progress indicator signal (SIGALRM,
SIGUSR1, or SIGINFO) or stop signal from a user (SIGTSTP)
arrived, the rest of the filenames were ignored and xz went
into an infinite loop.
(Also in v5.2, v5.4, and v5.6.)
* xz and xzdec on Linux: Support Landlock ABI version 10.
* lzmainfo: Open named files in binary mode. This matters on
Windows. Reading from standard input didn't have this bug.
(Also in v5.2, v5.4, and v5.6.)
* xzdiff: Fix "xzdiff foo_z" to decompress foo_z with gzip and
compare it against uncompressed file "foo".
* Tests:
- Fix test_files.sh failure with --disable-xz.
- Add new test files:
* file bad-1-powerpc-1.xz (60 bytes)
* Translations:
- Add Chinese (simplified), Chinese (traditional), and Latvian
man page translations.
- Add Chinese (simplified) and Latvian message translations.
- Update Spanish message translations.