]> git.ipfire.org Git - thirdparty/xz.git/commit
liblzma: mt dec: Don't free the input buffer too early (CVE-2025-31115)
authorLasse Collin <lasse.collin@tukaani.org>
Thu, 3 Apr 2025 11:34:42 +0000 (14:34 +0300)
committerLasse Collin <lasse.collin@tukaani.org>
Thu, 3 Apr 2025 11:34:42 +0000 (14:34 +0300)
commitd5a2ffe41bb77b918a8c96084885d4dbe4bf6480
tree7224261e74cc6a5dcc80180fa202c22f7a65e616
parentc0c835964dfaeb2513a3c0bdb642105152fe9f34
liblzma: mt dec: Don't free the input buffer too early (CVE-2025-31115)

The input buffer must be valid as long as the main thread is writing
to the worker-specific input buffer. Fix it by making the worker
thread not free the buffer on errors and not return the worker thread to
the pool. The input buffer will be freed when threads_end() is called.

With invalid input, the bug could at least result in a crash. The
effects include heap use after free and writing to an address based
on the null pointer plus an offset.

The bug has been there since the first committed version of the threaded
decoder and thus affects versions from 5.3.3alpha to 5.8.0.

As the commit message in 4cce3e27f529 says, I had made significant
changes on top of Sebastian's patch. This bug was indeed introduced
by my changes; it wasn't in Sebastian's version.

Thanks to Harri K. Koskinen for discovering and reporting this issue.

Fixes: 4cce3e27f529 ("liblzma: Add threaded .xz decompressor.")
Reported-by: Harri K. Koskinen <x64nop@nannu.org>
Reviewed-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Thanks-to: Sam James <sam@gentoo.org>
src/liblzma/common/stream_decoder_mt.c