]> git.ipfire.org Git - thirdparty/xz.git/commit
liblzma: Fix invalid free() after memory allocation failure.
authorLasse Collin <lasse.collin@tukaani.org>
Wed, 23 Nov 2022 19:26:21 +0000 (21:26 +0200)
committerLasse Collin <lasse.collin@tukaani.org>
Thu, 24 Nov 2022 08:58:04 +0000 (10:58 +0200)
commitf94a3e34603c56c55777056bb5412bfd0e948f0b
tree6cd911260426b112019cea5bc4637e7d07a08c06
parent8309385b444bce23e56256e21fb008a170434008
liblzma: Fix invalid free() after memory allocation failure.

The bug was in the single-threaded .xz Stream encoder
in the code that is used for both re-initialization and for
lzma_filters_update(). To trigger it, an application had
to either re-initialize an existing encoder instance with
lzma_stream_encoder() or use lzma_filters_update(), and
then one of the 1-4 tiny allocations in lzma_filters_copy()
(called from stream_encoder_update()) must fail. An error
was correctly reported but the encoder state was corrupted.

This is related to the recent fix in
f8ee61e74eb40600445fdb601c374d582e1e9c8a which is good but
it wasn't enough to fix the main problem in stream_encoder.c.
src/liblzma/common/stream_encoder.c