[git commit] xz: fix decoding of LZMA2 streams having no uncompressed data.
Denys Vlasenko
vda.linux at googlemail.com
Wed Feb 27 15:38:06 UTC 2013
commit: http://git.busybox.net/busybox/commit/?id=a1ae2b75a71b4b99948aa0f9a15cf1de52bb40d6
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master
No .xz encoder creates files with empty LZMA2 streams,
but such files would still be valid and decompressors
must accept them.
Note that empty .xz files are a different thing than
empty LZMA2 streams. This bug didn't affect typical .xz
files that had no uncompressed data.
Signed-off-by: Lasse Collin <lasse.collin at tukaani.org>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
archival/libarchive/unxz/xz_dec_lzma2.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/archival/libarchive/unxz/xz_dec_lzma2.c b/archival/libarchive/unxz/xz_dec_lzma2.c
index b6d10af..3c2dc88 100644
--- a/archival/libarchive/unxz/xz_dec_lzma2.c
+++ b/archival/libarchive/unxz/xz_dec_lzma2.c
@@ -971,6 +971,9 @@ XZ_EXTERN NOINLINE enum xz_ret XZ_FUNC xz_dec_lzma2_run(
*/
tmp = b->in[b->in_pos++];
+ if (tmp == 0x00)
+ return XZ_STREAM_END;
+
if (tmp >= 0xE0 || tmp == 0x01) {
s->lzma2.need_props = true;
s->lzma2.need_dict_reset = false;
@@ -1003,9 +1006,6 @@ XZ_EXTERN NOINLINE enum xz_ret XZ_FUNC xz_dec_lzma2_run(
lzma_reset(s);
}
} else {
- if (tmp == 0x00)
- return XZ_STREAM_END;
-
if (tmp > 0x02)
return XZ_DATA_ERROR;
More information about the busybox-cvs
mailing list