mirror of
https://git.tukaani.org/xz.git
synced 2026-10-31 03:14:56 +00:00
liblzma: Make lzma_lz_decoder_init() safe to reinit after alloc failure
If memory allocation fails and the resulting coder state is reused, ensure that memory allocation is attempted again. However, coders that are initialized via lzma_next_filter_init() shouldn't be reinitialized after failure; they should be cleaned up with lzma_next_end(). Reported-by: GitHub user christos-cantina-security (christos-spearbit)
This commit is contained in:
parent
9fc6f5cd87
commit
fe4d763d56
@ -278,6 +278,7 @@ lzma_lz_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
|
||||
|
||||
// Allocate and initialize the dictionary.
|
||||
if (coder->dict.size != alloc_size) {
|
||||
coder->dict.size = 0;
|
||||
lzma_free(coder->dict.buf, allocator);
|
||||
|
||||
// The LZ_DICT_EXTRA bytes at the end of the buffer aren't
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user