mirror of
https://git.tukaani.org/xz.git
synced 2024-04-04 12:36:23 +02:00
Fix data corruption in LZMA encoder. Note that this bug was
specific to liblzma and was *not* present in LZMA SDK.
This commit is contained in:
parent
7d516f5129
commit
e6eb0a2675
1 changed files with 4 additions and 0 deletions
|
@ -157,6 +157,10 @@ lzma_lzma_encode(lzma_coder *coder, uint8_t *restrict out,
|
||||||
// Initialize the stream if no data has been encoded yet.
|
// Initialize the stream if no data has been encoded yet.
|
||||||
if (!coder->is_initialized) {
|
if (!coder->is_initialized) {
|
||||||
if (coder->lz.read_pos == coder->lz.read_limit) {
|
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.write_pos == coder->lz.read_pos);
|
||||||
assert(coder->lz.sequence == SEQ_FINISH);
|
assert(coder->lz.sequence == SEQ_FINISH);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue