]> 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>
Wed, 23 Nov 2022 19:26:21 +0000 (21:26 +0200)
commit10430fbf3820dafd4eafd38ec8be161a6978ed2b
tree49bcef8fca97be3bb20ea2c17d9fb74dedc4a4aa
parentcafd6dc397ca8b5b5f7775e8d6876b8fe70f8e70
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