1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

lzma: Set *new_len even if data was truncated.

Commit 474f1f4268 did the same
to bzip2 and deflate.
This commit is contained in:
Kalle Olavi Niemitalo 2008-02-24 19:19:58 +02:00 committed by Kalle Olavi Niemitalo
parent 26607d2263
commit a03698d695

View File

@ -109,6 +109,8 @@ lzma_decode_buffer(unsigned char *data, int len, int *new_len)
unsigned char *buffer = NULL;
int error;
*new_len = 0; /* default, left there if an error occurs */
stream.next_in = data;
stream.avail_in = len;
@ -131,7 +133,6 @@ lzma_decode_buffer(unsigned char *data, int len, int *new_len)
error = lzma_code(&stream, LZMA_RUN);
if (error == LZMA_STREAM_END) {
*new_len = stream.total_out;
error = LZMA_OK;
break;
}
@ -139,13 +140,13 @@ lzma_decode_buffer(unsigned char *data, int len, int *new_len)
lzma_end(&stream);
if (error != LZMA_OK) {
if (error == LZMA_OK) {
*new_len = stream.total_out;
return buffer;
} else {
if (buffer) mem_free(buffer);
*new_len = 0;
return NULL;
}
return buffer;
}
static void