mirror of https://git.tukaani.org/xz.git
Fix a dumb bug in .lzma decoder which was introduced in
the previous commit. (Probably the previous commit has other bugs too, it wasn't tested.)
This commit is contained in:
parent
671a5adf1e
commit
653e457e37
|
@ -104,8 +104,10 @@ alone_decode(lzma_coder *coder,
|
||||||
case SEQ_UNCOMPRESSED_SIZE:
|
case SEQ_UNCOMPRESSED_SIZE:
|
||||||
coder->uncompressed_size
|
coder->uncompressed_size
|
||||||
|= (lzma_vli)(in[*in_pos]) << (coder->pos * 8);
|
|= (lzma_vli)(in[*in_pos]) << (coder->pos * 8);
|
||||||
|
++*in_pos;
|
||||||
|
if (++coder->pos < 8)
|
||||||
|
break;
|
||||||
|
|
||||||
if (++coder->pos == 8) {
|
|
||||||
// Another hack to ditch false positives: Assume that
|
// Another hack to ditch false positives: Assume that
|
||||||
// if the uncompressed size is known, it must be less
|
// if the uncompressed size is known, it must be less
|
||||||
// than 256 GiB. Again, if someone complains, this
|
// than 256 GiB. Again, if someone complains, this
|
||||||
|
@ -115,17 +117,14 @@ alone_decode(lzma_coder *coder,
|
||||||
>= (LZMA_VLI_C(1) << 38))
|
>= (LZMA_VLI_C(1) << 38))
|
||||||
return LZMA_FORMAT_ERROR;
|
return LZMA_FORMAT_ERROR;
|
||||||
|
|
||||||
coder->pos = 0;
|
|
||||||
coder->sequence = SEQ_CODER_INIT;
|
|
||||||
}
|
|
||||||
|
|
||||||
++*in_pos;
|
|
||||||
|
|
||||||
// Calculate the memory usage so that it is ready
|
// Calculate the memory usage so that it is ready
|
||||||
// for SEQ_CODER_INIT.
|
// for SEQ_CODER_INIT.
|
||||||
coder->memusage = lzma_lzma_decoder_memusage(&coder->options)
|
coder->memusage = lzma_lzma_decoder_memusage(&coder->options)
|
||||||
+ LZMA_MEMUSAGE_BASE;
|
+ LZMA_MEMUSAGE_BASE;
|
||||||
|
|
||||||
|
coder->pos = 0;
|
||||||
|
coder->sequence = SEQ_CODER_INIT;
|
||||||
|
|
||||||
// Fall through
|
// Fall through
|
||||||
|
|
||||||
case SEQ_CODER_INIT: {
|
case SEQ_CODER_INIT: {
|
||||||
|
|
Loading…
Reference in New Issue