From 596fa1fac72823e4ef5bc26bb53f9090445bf748 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Mon, 10 Mar 2008 13:44:29 +0200 Subject: [PATCH] Always initialize lz->temp_size in lz_decoder.c. temp_size did get initialized as a side-effect after allocating a new decoder, but not when the decoder was reused. --- src/liblzma/lz/lz_decoder.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/liblzma/lz/lz_decoder.c b/src/liblzma/lz/lz_decoder.c index 92aaff6a..63945a18 100644 --- a/src/liblzma/lz/lz_decoder.c +++ b/src/liblzma/lz/lz_decoder.c @@ -429,11 +429,6 @@ lzma_lz_decoder_reset(lzma_lz_decoder *lz, lzma_allocator *allocator, return LZMA_MEM_ERROR; } - // Clean up the temporary buffer to make it very sure that there are - // no information leaks when multiple steams are decoded with the - // same decoder structures. - memzero(lz->temp, LZMA_BUFFER_SIZE); - // Reset the variables so that lz_get_byte(lz, 0) will return '\0'. lz->pos = 0; lz->start = 0; @@ -442,6 +437,12 @@ lzma_lz_decoder_reset(lzma_lz_decoder *lz, lzma_allocator *allocator, lz->eopm_detected = false; lz->next_finished = false; lz->this_finished = false; + lz->temp_size = 0; + + // Clean up the temporary buffer to make it very sure that there are + // no information leaks when multiple steams are decoded with the + // same decoder structures. + memzero(lz->temp, LZMA_BUFFER_SIZE); // Set the process function pointer. lz->process = process;