diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2008-03-14 23:16:11 +0200 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2008-03-14 23:16:11 +0200 |
commit | e6eb0a26757e851cef62b9440319a8e73b015cb9 (patch) | |
tree | daa878953fb34dbf6446c76b01c71e934067cb4f /src/liblzma/lzma | |
parent | Fix a comment API header. (diff) | |
download | xz-e6eb0a26757e851cef62b9440319a8e73b015cb9.tar.xz |
Fix data corruption in LZMA encoder. Note that this bug was
specific to liblzma and was *not* present in LZMA SDK.
Diffstat (limited to 'src/liblzma/lzma')
-rw-r--r-- | src/liblzma/lzma/lzma_encoder.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/liblzma/lzma/lzma_encoder.c b/src/liblzma/lzma/lzma_encoder.c index 0fcb755c..01c823ca 100644 --- a/src/liblzma/lzma/lzma_encoder.c +++ b/src/liblzma/lzma/lzma_encoder.c @@ -157,6 +157,10 @@ lzma_lzma_encode(lzma_coder *coder, uint8_t *restrict out, // Initialize the stream if no data has been encoded yet. if (!coder->is_initialized) { if (coder->lz.read_pos == coder->lz.read_limit) { + if (coder->lz.sequence == SEQ_RUN) + return false; // We cannot do anything. + + // We are finishing (we cannot get here when flushing). assert(coder->lz.write_pos == coder->lz.read_pos); assert(coder->lz.sequence == SEQ_FINISH); } else { |