commit 4ff438ec456af147cd881dc2e168c7d555ef5b51
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-12-03 17:56:24 +0200

    Bump version and soname for 5.8.5

 src/liblzma/Makefile.am        | 2 +-
 src/liblzma/api/lzma/version.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

commit aafc1783c22eee08941eb1b81920ab6491266c2d
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-12-03 17:56:24 +0200

    Add NEWS for 5.8.5

 NEWS | 187 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 187 insertions(+)

commit f8f6bd813e77d1de608244e26e458e4a2e0dbefb
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-12-03 17:54:54 +0200

    Build: Add tuklib_cgroup.c and tuklib_cgroup.h to EXTRA_DIST
    
    Fixes: a38dc905e20b ("tuklib_physmem/cpucores: Support Linux cgroup v2 memory.max and cpu.max")

 src/Makefile.am | 2 ++
 1 file changed, 2 insertions(+)

commit 7f20dea02e81c7d1825b8dfbbfc0defbcd50db24
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-12-03 17:48:32 +0200

    Build: Update m4/ax_pthread.m4 from Autoconf Archive

 m4/ax_pthread.m4 | 36 ++++++++++++++++++++++++++++++------
 1 file changed, 30 insertions(+), 6 deletions(-)

commit 4186f19151d227675daa243ee5f1ede9c943ae9c
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-12-03 12:52:49 +0200

    Update THANKS

 THANKS | 2 ++
 1 file changed, 2 insertions(+)

commit bacd4676214c80d79fa4e53bc0057c82350ae811
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-12-02 15:52:11 +0200

    liblzma: Fix a data corruption issue in the LZMA2 encoder
    
    There is an off-by-a-few-bytes mistake. If triggered in a debug build,
    an assertion will fail. Non-debug builds will produce invalid LZMA2 data,
    but recovery might be possible[*]. If the dictionary size is smaller than
    64 KiB and some extra conditions are met, triggering the bug can result
    in memory reads a few bytes before the beginning of an array. If it
    doesn't crash, those bytes are leaked to the output stream and the file
    won't be recoverable.
    
    The bug was discovered by analysing the code. There are no reports
    of observed data corruption. As of writing, I haven't managed to
    trigger the bug without modifying the buggy condition to be even more
    incorrect, so I don't have a test for this bug.
    
    The bug is specific to liblzma; it wasn't inherited from LZMA SDK.
    
    Make LZMA2 encoder produce two uncompressed chunks when needed. This
    might be needed later anyway if the encoder is revised some day.
    The LZMA2 encoder in XZ for Java has done it similarly since the
    beginning (2011).
    
    Don't fix the incorrect condition because it would change the encoder
    output with most non-small files. While there's nothing wrong that
    different encoder versions produce different output, there unfortunately
    are use cases where people want to reproduce the exact compressed output,
    and it would be bad if only a known-to-be-buggy encoder could do that.
    It's best to not change the output solely to fix this particular issue
    except for the rare cases where the old code produced broken output.
    
    [*] If one knows that one has hit this specific bug, data recovery might
        be possible by modifying LZMA2 decoder to add 64 KiB to the sizes of
        very tiny uncompressed chunks. This can be done by adding the
        following at the end of "case SEQ_COMPRESSED_1:" in lzma2_decoder.c
        (this might even need 11 instead of 2):
    
            if (coder->sequence == SEQ_COPY && coder->compressed_size <= 2)
                coder->compressed_size += 65536;
    
        Note that this will create a new error if LZMA2 stream correctly ends
        in a tiny uncompressed chunk; it's only a hack for data recovery.
    
    Reported-by: Vladimir Kukharenko (GenProof)

 src/liblzma/lz/lz_encoder.h      |  6 ++---
 src/liblzma/lzma/lzma2_encoder.c | 49 ++++++++++++++++++++++++++++++++++------
 2 files changed, 45 insertions(+), 10 deletions(-)

commit 08c80fba1abd89a463e01a444683cfc1011ec054
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-10-26 15:17:33 +0200

    liblzma: Add comments to the x86 BCJ filter

 src/liblzma/simple/x86.c | 179 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 179 insertions(+)

commit 3c3166e6abcc1b2d9a53ef53ea655759fbd2995f
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-10-26 15:17:33 +0200

    liblzma: Add a speed optimization to the x86 filter
    
    Since at least five bytes of input are available, one can compare
    five bytes until checking for i < size again.
    
    If unaligned access is fast, one could use 32-bit reads and check each
    byte in the uint32_t. On some systems with specific inputs it was
    slightly faster, but the benefit wasn't big enough and consistent enough
    compared to this endianness-neutral byte-by-byte version.

 src/liblzma/simple/x86.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

commit e6a3126546064b6dc45568a24385d08fd36f4ed9
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-10-26 15:17:33 +0200

    liblzma: Fix and revise the x86 BCJ filter
    
    If the x86 filter was called with a buffer size exceeding about 4 GiB,
    with certain inputs it could corrupt data or hang (infinite loop). It
    was a size_t vs. uint32_t issue that had been introduced when the code
    was adapted from LZMA SDK; the bug didn't exist in the LZMA SDK code.
    
    Most apps (including xz) use small buffers to pass data to and from
    liblzma. In such apps the bug cannot be triggered.
    
    The old code was based on a very old LZMA SDK. Revise the code entirely.
    The new code is simpler, faster, and more readable than the old version.
    
    Reported-by: Vladimir Kukharenko (GenProof)
    Also-reported-by: GitHub user katie-andtruth

 src/liblzma/simple/x86.c | 122 ++++++++++++++++-------------------------------
 1 file changed, 42 insertions(+), 80 deletions(-)

commit 61bc5a621ca7db2616970b9d999ddc789d4aa2d9
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-10-17 18:37:39 +0300

    liblzma: mt enc: Clarify worker thread error reporting
    
    It worked correctly, but it was a bit confusing that on errors
    a worker thread returned itself to the stack of free threads,
    and the main thread still accessed that worker_thread struct.
    Since the access was always to the most recently started thread,
    there was no risk that the worker could have been reused, but
    with this commit it's more obvious.
    
    Thanks-to: Mar <mardgez13@gmail.com>

 src/liblzma/common/stream_encoder_mt.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

commit 279694f381f9f4d81d55d82ada73ed553196f078
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-10-25 16:39:54 +0200

    liblzma: mt enc: Tweak a comment

 src/liblzma/common/stream_encoder_mt.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

commit 556cc1f70f096877e2b61991a482744054c2f8a7
Author: Mar <mardgez13@gmail.com>
Date:   2026-10-25 14:34:48 +0100

    liblzma: mt enc: Initialize the coder only after the old threads stop
    
    stream_encoder_mt_init() set coder->block_size and coder->thread_error
    before it stopped or ended the worker threads of the previous use of
    the coder. A worker that had just been started could still read
    coder->block_size in worker_encode(), and a worker that failed in that
    window could still set coder->thread_error, which the new stream would
    then return as its own error.
    
    ThreadSanitizer reports the former as a data race in
    test_stream_encoder_mt (test_bug2).
    
    Do the basic initializations after threads_stop() or threads_end().
    The old block size is then still in coder->block_size when it is
    compared to the new one.

 src/liblzma/common/stream_encoder_mt.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

commit 45a4a72e46f140ab5fd032107992b25bb64004eb
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-10-17 18:37:39 +0300

    liblzma: mt enc: Add assertions

 src/liblzma/common/stream_encoder_mt.c | 5 +++++
 1 file changed, 5 insertions(+)

commit ddd26d6b0474b77ee2e0a131b03186b7eb96f42f
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-10-17 18:37:39 +0300

    Tests: Add tests for the threaded encoder bugs
    
    test_bug1 results in invalid memory writes if the bug fix is reverted.
    It should consistently crash even without sanitizers.
    
    test_bug2 and test_bug3 depend on timing luck. They aren't guaranteed to
    fail every time or on every system if the bug fixes are reverted.
    Especially test_bug3 can be difficult to trigger, but I didn't want
    to increase the iteration count a lot because then the single test
    would consume most of the execution time of the entire test suite.
    
    Thanks-to: Mar <mardgez13@gmail.com>

 tests/Makefile.am              |   2 +
 tests/test_stream_encoder_mt.c | 195 +++++++++++++++++++++++++++++++++++++++++
 tests/tests.cmake              |   1 +
 3 files changed, 198 insertions(+)

commit e760de811aaf0ddac117a8ef0faa82051b01fd03
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-10-17 18:37:39 +0300

    liblzma: mt enc: Fix threads_stop(coder, true)
    
    threads_stop(coder, true) waited for all workers to be in the THR_IDLE
    state. However, worker threads self-reset to THR_IDLE before they had
    done their final cleanup steps. This could result in data corruption
    or wrong progress indicator information if threaded encoder was
    reinitialized when lzma_code() hadn't returned LZMA_STREAM_END.
    
    Change threads_stop(coder, true) to wait until all initialized threads
    are in the stack of free threads. (An alternative would have been to
    set THR_IDLE when both thr->coder->mutex and thr->mutex are locked.)
    Note that after LZMA_STREAM_END, the threads are already on the stack
    of free threads.
    
    Fixes: de678e0c924a ("liblzma: Add lzma_stream_encoder_mt() for threaded compression.")

 src/liblzma/common/stream_encoder_mt.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

commit 2895f1cdbe50020e6ba1ae87b7d2185d5c508430
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-10-17 18:37:39 +0300

    liblzma: mt enc: Always return workers to coder->threads_free on THR_STOP
    
    If the main thread started a worker thread by changing the state from
    THR_IDLE to THR_RUN, and very soon the main thread told the same worker
    to stop by setting the state to THR_STOP, and the worker hadn't yet
    woken up and reacted to THR_RUN, the worker would simply set the state
    back to THR_IDLE. This was wrong because on THR_STOP the worker needs
    to return itself to the stack of free threads (thr->coder->threads_free).
    
    This bug could result in a deadlock if threaded encoder was reinitialized
    when lzma_code() hadn't returned LZMA_STREAM_END.
    
    Reported-by: Mar <mardgez13@gmail.com>
    Fixes: de678e0c924a ("liblzma: Add lzma_stream_encoder_mt() for threaded compression.")

 src/liblzma/common/stream_encoder_mt.c | 32 +++++++++++++-------------------
 1 file changed, 13 insertions(+), 19 deletions(-)

commit aeaeb79deda7262c82afc88640af992be05414ef
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-10-17 18:37:39 +0300

    liblzma: mt enc: Don't reuse threads on reinit if block size differs
    
    When a worker thread is created, a per-thread input buffer is allocated.
    Its size is equal to the block size in all threads.
    
    On reinitialization, the code didn't check if the new block size is
    different than the old block size, and reused the threads even if
    it wasn't. If the new block size was larger than the old one,
    a buffer overflow would occur.
    
    Typically (including in xz), if the encoder state is reused, it is
    reinitialized with the same options, and then the bug won't be triggered.
    
    Reported-by: Mar <mardgez13@gmail.com>
    Fixes: de678e0c924a ("liblzma: Add lzma_stream_encoder_mt() for threaded compression.")

 src/liblzma/common/stream_encoder_mt.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

commit 9dfe57f32f27292064438b50e525da568a28205f
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-12-03 11:52:31 +0200

    xz: Fix comments

 src/xz/signals.c | 6 +++---
 src/xz/signals.h | 5 ++---
 2 files changed, 5 insertions(+), 6 deletions(-)

commit c5257f9d7e8af4282f6455aadaff34a95e92b159
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-12-01 14:37:39 +0200

    liblzma: Catch invalid internal state in lzma_index_cat()
    
    The internal state should be such that LZMA_VLI_UNKNOWN is impossible
    here, but check for it anyway.
    
    Fixes: Coverity CID 464639

 src/liblzma/common/index.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

commit 54682752e1667938da0fd755ffc8fab391d77534
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-12-01 11:59:07 +0200

    CI: Upgrade coverity-scan-action to v1.11.0

 .github/workflows/coverity.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

commit 63335e4ad9f27a013e1c90b488875988d9bd1306
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-30 18:27:38 +0200

    Tests: test_raw: Really fix the build when features are disabled

 tests/test_raw.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

commit 7d38ad9fa7f5264f639d5ed98ec2845d8cf319da
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-30 18:17:12 +0200

    Tests: test_raw: Fix the build when features are disabled
    
    Fixes: 8d19cef966fc ("Tests: Add a test for the preset dictionary sanitizer issue")

 tests/test_raw.c | 4 ++++
 1 file changed, 4 insertions(+)

commit f24b0ad02d4a60979a567cd5b11edc75c6bd1bdd
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-30 17:07:40 +0200

    xz: Fix EINTR handling in --files and --files0
    
    Progress indicator signals (SIGALRM, SIGUSR1, and SIGINFO) and SIGTSTP
    don't set user_abort. If such a signal was received when waiting for
    more input from the file specified with --files or --files0, the
    remaining filenames were ignored and xz went into an infinite loop.
    xz still reacted to SIGINT and such signals normally.
    
    It can be reproduced at least on Linux/glibc:
    
        ( echo /dev/null; sleep 2; echo /dev/null ) | xz -vc --files > /dev/null

 src/xz/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

commit 0155305fde65979e0d365b1dfe6f34953fd44acd
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-30 16:29:36 +0200

    Tests: Add a test for lzma_easy_decoder_memusage()

 tests/test_stream_buffer_decode.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

commit 661d2c4455a71507db2b23c5fd017fadd0d659c6
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-30 16:22:58 +0200

    liblzma: Make lzma_easy_decoder_memusage() return UINT64_MAX on error
    
    See: 777494777069 ("liblzma: Make lzma_easy_encoder_memusage() return UINT64_MAX on error")

 src/liblzma/api/lzma/container.h           | 3 ++-
 src/liblzma/common/easy_decoder_memusage.c | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

commit 25dcc02ae730b7959ad81a367963222f79c7b5b2
Author: hyc-alt <250169095+hyc-alt@users.noreply.github.com>
Date:   2026-11-27 18:48:45 +0800

    Tests: Test lzma_stream_decoder_mt(&strm, NULL)
    
    Link: https://github.com/tukaani-project/xz/pull/268

 tests/test_memlimit.c | 2 ++
 1 file changed, 2 insertions(+)

commit 3ff4b18811920559d1e51ef9f75b2601d6df2e34
Author: hyc-alt <250169095+hyc-alt@users.noreply.github.com>
Date:   2026-11-27 18:48:45 +0800

    liblzma: mt dec: Check for options == NULL
    
    Link: https://github.com/tukaani-project/xz/pull/268

 src/liblzma/common/stream_decoder_mt.c | 3 +++
 1 file changed, 3 insertions(+)

commit 46b84e9bf5a8181573166bfc5048ff211e0d5b8f
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-28 17:39:46 +0200

    liblzma: Document lzma_memusage() bugs

 src/liblzma/api/lzma/base.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

commit 111f5cb6de0c0afbef5d46a51eeb01eafaa4b8ff
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-28 15:35:56 +0200

    liblzma: mt dec: Set mem_direct_mode before Block decoder init
    
    If Block decoder initialization fails due to allocation failure, it's
    nice if lzma_memusage() will then return the amount of memory that the
    decoder tried to allocate. Before this commit, the return value was from
    the previous Block if it used direct mode, or LZMA_MEMUSAGE_BASE (32 KiB).

 src/liblzma/common/stream_decoder_mt.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

commit a70538890b3a7102240e3653d65398aa7b3d4ca5
Author: hyc-alt <250169095+hyc-alt@users.noreply.github.com>
Date:   2026-11-27 18:48:45 +0800

    Tests: Test the lzma_memusage() bug in lzma_stream_decoder_mt()
    
    This fails before the previous commit.
    
    Co-authored-by: Lasse Collin <lasse.collin@tukaani.org>
    Link: https://github.com/tukaani-project/xz/pull/268

 tests/test_memlimit.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

commit 5b4fff9eb11a57fae5363a40cb77972d04178250
Author: hyc-alt <250169095+hyc-alt@users.noreply.github.com>
Date:   2026-11-27 18:48:45 +0800

    liblzma: mt dec: Fix lzma_memusage() after LZMA_MEMLIMIT_ERROR
    
    If lzma_code() returned LZMA_MEMLIMIT_ERROR, a call to lzma_memusage()
    didn't return the required amount of memory (it could return a small
    value like LZMA_MEMLIMIT_BASE i.e. 32 KiB). Using lzma_memlimit_set()
    with the bogus value succeeded, but attempting to continue decoding
    kept failing with LZMA_MEMLIMIT_ERROR.
    
    In xz, the nonsense from lzma_memusage() was seen in an error message:
    
        $ echo foo | xz > foo.xz
        $ xz --test --memlimit=5MiB foo.xz
        xz: foo.xz: Memory usage limit reached
        xz: 1 MiB of memory is required. The limit is 5 MiB.
    
    LZMA_MEMLIMIT_ERROR may be returned at the beginning of SEQ_BLOCK_INIT.
    There the amount of memory required for the filter chain (and thus the
    single-threaded direct mode) is available in coder->mem_next_filters.
    Treat SEQ_BLOCK_INIT specially in _memconfig() and ensure that the
    reported memusage is at least mem_next_filters.
    
    Co-authored-by: Lasse Collin <lasse.collin@tukaani.org>
    Link: https://github.com/tukaani-project/xz/pull/268

 src/liblzma/common/stream_decoder_mt.c | 8 ++++++++
 1 file changed, 8 insertions(+)

commit 1be9f848a2bf9f88928b1188ab06a41abb566ce2
Author: hyc-alt <250169095+hyc-alt@users.noreply.github.com>
Date:   2026-11-27 18:48:45 +0800

    liblzma: mt dec: Fix a mutex and cond leak
    
    Link: https://github.com/tukaani-project/xz/pull/268

 src/liblzma/common/stream_decoder_mt.c | 3 +++
 1 file changed, 3 insertions(+)

commit 47754726e9303bdd466d084a99dbb7d18297985b
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-28 12:20:28 +0200

    liblzma: mt enc: Refactor when coder->next is assigned
    
    It was done this way in mt decoder in the previous commit. simple_coder.c
    has always done it like this.

 src/liblzma/common/stream_encoder_mt.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

commit 01ae8d0f3ed89b485427659132fa34a2c410951d
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-28 12:13:46 +0200

    liblzma: mt dec: Fix a double free after mutex or cond init error
    
    Reported-by: GitHub user hyc-alt
    Link: https://github.com/tukaani-project/xz/pull/268

 src/liblzma/common/stream_decoder_mt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

commit c61d83b20fa2903be438752e827f67232e514f96
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-25 18:36:32 +0200

    liblzma: Free cached memory if new memlimit is low
    
    If a decoder was reinitialized with a memory limit that was lower than
    the size of the cached allocations, the memory usage of the freshly-
    reinitialized decoder would be above the new limit. Fix by freeing the
    cached memory if its memory usage is higher than the new limit.
    
    Side note: If lzma_memlimit_set() is called with a memlimit that is
    lower than the size of the cached allocations, the call will fail.
    It isn't worth it to make lzma_memlimit_set() free the cached allocations
    to meet the new memlimit.

 src/liblzma/common/alone_decoder.c     |  7 +++++++
 src/liblzma/common/auto_decoder.c      | 16 ++++++++++++++++
 src/liblzma/common/lzip_decoder.c      |  7 +++++++
 src/liblzma/common/stream_decoder.c    |  7 +++++++
 src/liblzma/common/stream_decoder_mt.c | 11 ++++++++---
 5 files changed, 45 insertions(+), 3 deletions(-)

commit d5d2aeee83fc14182b694a80d467e81cdb614f1d
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-25 18:36:32 +0200

    liblzma: Make lzma_memusage() account cached memory
    
    lzma_stream_decoder(), lzma_alone_decoder(), and lzma_lzip_decoder():
    If lzma_memusage() was called immediately after a decoder was
    reinitialized, the memory used by the still-allocated old decoder
    was ignored and thus the return value was misleading. Once a few
    bytes of input had been consumed and the memory usage of the new
    input was known, then the cached allocation was either reused or
    freed, and lzma_memusage() returned correct information.
    
    lzma_stream_decoder_mt() and lzma_auto_decoder() already counted
    the cached memory this way. To fix the inconsistency, the other
    three were modified to have this behavior too.
    
    This also affects the behavior of lzma_memlimit_set() if it is called
    immediately after decoder reinitialization. With the decoders that
    didn't account for the cached memory, lzma_memlimit_set() could be
    used to set the memlimit to a much smaller value than the amount
    of cached allocations. Now it will fail with LZMA_MEMLIMIT_ERROR.
    In practice this shouldn't matter. The main use case is to increase
    the limit after lzma_code() has returned LZMA_MEMLIMIT_ERROR.
    Decreasing the limit with lzma_memlimit_set() is possible but it's
    a bit weird thing to do.

 src/liblzma/common/alone_decoder.c  | 2 +-
 src/liblzma/common/lzip_decoder.c   | 2 +-
 src/liblzma/common/stream_decoder.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

commit dc424a6cf9a5eaafb6903d5c3c9b003dcb1f1d75
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-25 18:36:32 +0200

    liblzma: Fix lzma_memlimit_get() after reinit of lzma_auto_decoder()
    
    If lzma_memlimit_get() was called right after reinitialization with
    lzma_auto_decoder(), lzma_memlimit_get() returned the old memlimit
    instead of the current one.
    
    In debug builds, this resulted in an assertion failure if the new and
    old limits weren't equal. The failure occurred with lzma_memusage(),
    lzma_memlimit_set(), and lzma_memlimit_get() because they all call
    the same internal function.
    
    Reported-by: Pu Cheng
    Fixes: https://github.com/tukaani-project/xz/pull/266

 src/liblzma/common/auto_decoder.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

commit b60ede03d1c0c5a232583515408da8d2bcfd906c
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-23 18:02:48 +0200

    Update THANKS

 THANKS | 1 +
 1 file changed, 1 insertion(+)

commit 3334c36726911f4df5d91c1319036fd9fd282786
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-23 18:02:48 +0200

    liblzma: Prefetch the next position's hash buckets
    
    This is for HC3, HC4, BT3, and BT4. This can reduce encoding time by
    a couple of percent.
    
    Co-authored-by: Yousef Mahmoud <yosefkhalil610@gmail.com>
    Closes: https://github.com/tukaani-project/xz/pull/247

 src/liblzma/lz/lz_encoder_mf.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

commit 4083cbd8b3ec717e90a26ee614d3affcba016c9c
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-23 18:02:48 +0200

    liblzma: Reserve memory for match finder prefetching
    
    Extra bytes were already reserved for lzma_memcmplen(). Define a new
    constant LZ_EXTRA_SIZE that is large enough for both lzma_memcmplen()
    and for prefetching.

 src/liblzma/lz/lz_encoder.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

commit 89afa6290893a461d61c5118c8de90bd91436095
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-23 18:02:48 +0200

    liblzma: Add hash table prefetching macros
    
    Co-authored-by: Yousef Mahmoud <yosefkhalil610@gmail.com>
    Link: https://github.com/tukaani-project/xz/pull/247

 src/liblzma/lz/lz_encoder_hash.h | 45 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

commit 7e1474946dad57781f4eb8b4005faf51782664b1
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-23 18:02:48 +0200

    liblzma: Some cleanups to the unused hash calculation macros
    
    hash_5_calc() didn't even compile.

 src/liblzma/lz/lz_encoder_hash.h | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

commit 6c0dd306250922b0abe26d78fb479ff9e2c42407
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-23 18:02:48 +0200

    liblzma: Use a temporary variable in hash calculation

 src/liblzma/lz/lz_encoder_hash.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

commit 8d19cef966fc47ad721985d1f6e679cfeae60b9a
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-23 18:02:48 +0200

    Tests: Add a test for the preset dictionary sanitizer issue
    
    Before the previous commit, this could fail with -fsanitize=memory or
    with Valgrind. The only harm of the bug was sanitizer and Valgrind noise.

 tests/Makefile.am |  2 ++
 tests/test_raw.c  | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/tests.cmake |  1 +
 3 files changed, 81 insertions(+)

commit b02fdc66b4f9fcdf2f7316a087ee5e94ae377986
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-23 18:02:48 +0200

    liblzma: Silence Valgrind and -fsanitize=memory with a preset dictionary
    
    lzma_memcmplen() reads a few extra bytes, but eventually it ignores them.
    Valgrind and -fsanitize=memory don't see it and still complained about
    use of uninitialized values. The initialization was in fill_window(), but
    it had been forgotten from the preset dictionary handling.
    
    Fixes: 5db75054e900 ("liblzma: Use lzma_memcmplen() in the match finders.")
    Reported-by: Yousef Mahmoud <yosefkhalil610@gmail.com>
    Link: https://github.com/tukaani-project/xz/pull/247#issuecomment-6879866832

 src/liblzma/lz/lz_encoder.c | 4 ++++
 1 file changed, 4 insertions(+)

commit d611e8de3b75fb59c079dd2fc24238a8a696de1d
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-23 18:02:48 +0200

    liblzma: Remove an unneeded memzero()
    
    This was in the original version (first commit below) but it didn't have
    the intended effect. It wasn't removed when the proper fix (second commit
    below) was added.
    
    Fixes: 5db75054e900 ("liblzma: Use lzma_memcmplen() in the match finders.")
    Fixes: fec88d41e672 ("liblzma: Silence harmless Valgrind errors.")

 src/liblzma/lz/lz_encoder.c | 5 -----
 1 file changed, 5 deletions(-)

commit c308e9f27201300fd042d3e7324a21e55c25852f
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-23 12:27:47 +0200

    liblzma: Tweak rc_direct() x86-64 assembly
    
    This seems slightly faster on modern processors when microbenchmarking.
    It also needs one fewer temporary variable.
    
    rc_direct() is the least hottest thing that has inline assembly, so in
    practice this change shouldn't make a noticeable difference in speed.

 src/liblzma/rangecoder/range_decoder.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

commit 288448f9aa132bbfe0fd74b2081668939dbcffdd
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-17 20:06:27 +0200

    Tests: Add tests for concatenated lzma_index growing too large
    
    This fails before the previous commit.

 tests/test_index.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

commit e44c4108b83ea0b9387192348f52dd6504327bc9
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-22 19:22:05 +0200

    liblzma: Fix an integer overflow detection in lzma_index_append()
    
    If lzma_indexes had been concatenated using lzma_index_cat(),
    lzma_index_append() didn't detect if the total uncompressed size
    of the concatenated lzma_index would grow past LZMA_VLI_MAX; it
    only checked against the last Stream in lzma_index.
    
    Typically one doesn't use lzma_index_append() after lzma_index_cat(),
    so it's likely that few, if any, apps can trigger this bug.
    
    Also add a few related assertions.
    
    Reported-by: GitHub user katie-andtruth

 src/liblzma/common/index.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

commit 1a544ed520b0059f5e18e2c57be10b53e212917b
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-22 13:36:41 +0200

    Update THANKS

 THANKS | 2 ++
 1 file changed, 2 insertions(+)

commit b387ea5a87b70fffbb359c63b10f2cbb67733e22
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-17 19:01:18 +0200

    liblzma: Add a null pointer check to lzma_get_progress()
    
    If lzma_get_progress() was called when no coder was initialized in
    the lzma_stream, it would crash due to strm->internal being NULL.
    Apps shouldn't have any need to call lzma_get_progress() on such
    lzma_streams, but it must still work.
    
    Reported-by: GitHub user katie-andtruth
    Reported-by: Pu Cheng
    Closes: https://github.com/tukaani-project/xz/pull/267

 src/liblzma/common/common.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

commit 52b65f131648806254a3566a1dda23df61237c7e
Author: Pu Cheng <217626997+GeekQAQ@users.noreply.github.com>
Date:   2026-11-20 03:17:13 +0800

    liblzma: Free memory and reset counters if lzma_easy_encoder() fails
    
    If the preset was unsupported, lzma_easy_encoder() returned
    LZMA_OPTIONS_ERROR without calling lzma_stream_encoder(). If strm was
    being reused without calling lzma_end() first, the old encoder was
    left allocated and strm->total_in and strm->total_out weren't reset.
    
    lzma/base.h and lzma/container.h say that no memory is left allocated
    after a failed initialization. Thus an application that follows the docs
    leaked the old coder.
    
    Closes: https://github.com/tukaani-project/xz/pull/265

 src/liblzma/common/easy_encoder.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

commit 5d8a735db7614599a7cd527af739c6e59370e3aa
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-17 19:13:15 +0200

    liblzma: Initialize total_in and total_out even if an error occurs
    
    Reported-by: GitHub user katie-andtruth
    Reported-by: Pu Cheng
    Link: https://github.com/tukaani-project/xz/pull/265

 src/liblzma/common/common.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

commit 8c1f4f33a25fb2f13c31b29fc40e84dcac12045f
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-17 18:58:29 +0200

    Tests: Add a test for lzma_easy_encoder_memusage()

 tests/test_stream_buffer_encode.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

commit 777494777069958a3fa6189d3a4267d762f0fa65
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-17 18:43:05 +0200

    liblzma: Make lzma_easy_encoder_memusage() return UINT64_MAX on error
    
    Very early version of the code used uint32_t and UINT32_MAX. The function
    name and return type were changed but the error code wasn't.
    
    Reported-by: GitHub user katie-andtruth

 src/liblzma/api/lzma/container.h           | 2 ++
 src/liblzma/common/easy_encoder_memusage.c | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

commit 4193f95253d04af7e43b2c3774a521cf1cba49aa
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-17 19:23:30 +0200

    liblzma: Fix lzma_filter_flags_decode() docs about in_pos
    
    In this case it's better to change the docs than change the code. While
    the function is exported, it's primarily used internally in liblzma
    in lzma_block_header_decode(). There it doesn't matter if *in_pos is
    updated on error.
    
    Reported-by: GitHub user katie-andtruth

 src/liblzma/api/lzma/filter.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

commit d32f00d601f6ccc48bd5b7ba33b4e96f22f49cf6
Author: Daniel Robbins <drobbins@kernel-seeds.org>
Date:   2026-08-09 20:17:52 +0300

    Tests: Add a test for Linux cgroup v2 memory.max and cpu.max
    
    Co-authored-by: Lasse Collin <lasse.collin@tukaani.org>
    Link: https://github.com/tukaani-project/xz/pull/235

 tests/Makefile.am          |  2 ++
 tests/test_linux_cgroup.sh | 68 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/tests.cmake          | 12 ++++++++
 3 files changed, 82 insertions(+)

commit 6f6b25e30401082ae19cd24b73e120ac385eaa1f
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-07-19 19:10:58 +0300

    xz: Cache the result from lzma_cputhreads()
    
    Reading Linux cgroup v2 cpu.max is several syscalls. This slightly
    simplifies hardware.c too.

 src/xz/hardware.c | 30 +++++++++++-------------------
 1 file changed, 11 insertions(+), 19 deletions(-)

commit 3d0804faac7a9aaf55f87ef3d43713f4d1b724a1
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-11 12:34:43 +0200

    liblzma: Update API docs to mention cgroup v2 memory.max and cpu.max

 src/liblzma/api/lzma/hardware.h | 8 ++++++++
 1 file changed, 8 insertions(+)

commit 85590511c0081dd834e1c902864b0d7cac2185fc
Author: Daniel Robbins <drobbins@kernel-seeds.org>
Date:   2026-08-05 00:25:34 -0400

    tuklib_cgroup: Keep looking for limits in parent cgroups
    
    Controller files are exposed to a child only when the controller is
    enabled in its parent. Thus memory.max or cpu.max may be missing in the
    process's cgroup even while an ancestor still imposes a limit.
    
    Continue walking toward the root after open() fails so such limits
    aren't missed.
    
    Link: https://github.com/tukaani-project/xz/pull/235

 src/common/tuklib_cgroup.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

commit a38dc905e20b29d2f59cadf4c67557d8807ec070
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-07-19 19:10:58 +0300

    tuklib_physmem/cpucores: Support Linux cgroup v2 memory.max and cpu.max
    
    If cgroup v2 memory.max is lower than the amount of physical memory,
    tuklib_physmem() now returns the effective memory.max value. This
    feels reasonable because memory.max triggers OOM killer just like
    running out of real RAM does, and memory.max is shared by all processes
    in the same cgroup.
    
    This fixes a similar issue that occurred with resource limits. See
    the commit e8838b2f5922 ("xz: Look at resource limits when determining
    the default memlimit"). That change was done in src/xz/hardware.c, not
    tuklib_physmem.c, because RLIMIT_DATA and RLIMIT_AS are per-process
    limits and thus xz's memory usage can safely grow fairly close to those
    limits.
    
    Similarly, check for cpu.max in tuklib_cpucores(). There's no point
    in creating more threads by default than what can effectively be used.
    
    Thanks-to: Daniel Robbins <drobbins@kernel-seeds.org>
    Fixes: https://github.com/tukaani-project/xz/issues/234

 CMakeLists.txt               |   2 +
 src/common/tuklib_cgroup.c   | 193 +++++++++++++++++++++++++++++++++++++++++++
 src/common/tuklib_cgroup.h   |  41 +++++++++
 src/common/tuklib_cpucores.c |  11 +++
 src/common/tuklib_cpucores.h |   2 +
 src/common/tuklib_physmem.c  |  10 +++
 src/common/tuklib_physmem.h  |   5 ++
 src/liblzma/Makefile.am      |   4 +-
 8 files changed, 267 insertions(+), 1 deletion(-)

commit f54febc540607b3bdee0a0e6793355df2a7e9f61
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-08 20:13:57 +0200

    NEWS of 5.8.4: A CVE was never assigned for GHSA-5qpq-xqfv-j9pg

 NEWS | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

commit 9504094f089b3572e6c233a76c6f618f864ca317
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-08 20:13:10 +0200

    Translation: Update Latvian man page translations

 po4a/lv.po | 257 ++++++++++++++++++++++++++++++-------------------------------
 1 file changed, 128 insertions(+), 129 deletions(-)

commit f8a2ef0fba09c015c50825349b32acd35e1ccac8
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-08 20:09:15 +0200

    Translations: Update the Latvian translation

 po/lv.po | 137 ++++++++++++++++++++++++++++++++-------------------------------
 1 file changed, 69 insertions(+), 68 deletions(-)

commit 941bde613e214522fcba68b1a2baf4068e5d25d7
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-05 19:52:21 +0200

    Tests/CMake: Put decode_byte_by_byte to the same dir as shared liblzma
    
    For the reasoning, see the commit 18769dd6927f ("CMake: Don't put test
    binaries in a subdirectory").
    
    Fixes: 13fc756371c5 ("Tests: Add decode_byte_by_byte and use it from test_files.sh")

 tests/test_files.sh | 8 +++++---
 tests/tests.cmake   | 4 ----
 2 files changed, 5 insertions(+), 7 deletions(-)

commit 8926bc6800b01ac4a482dd634499c64fef895037
Author: Lasse Collin <lasse.collin@tukaani.org>
Date:   2026-11-05 19:49:53 +0200

    Tests: Fix test_files.sh to test xzdec with CMake builds too
    
    tests/tests.cmake only pass one argument to test_files.sh, but
    test_files.sh expected a second argument for the xzdec directory.
    In CMake builds, all executables that depend on liblzma must be
    in the same directory (due to how Windows searches for DLLs), so
    one argument is enough.

 tests/test_files.sh | 4 ++--
[--snip--]
