Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

fails to check stream CRC #5

Closed
kjn opened this Issue · 2 comments

2 participants

@kjn
Owner

lbzip2 fails to check stream CRC when decompressing bzip2 some files with blocks larger than 1 MiB (highly compressible blocks). As the result these files aren't decompressed correctly. Note than lbzip2 itself never creates such files, so this bug doesn't affect decompressing files created by any version of lbzip2.

Ways to reproduce it:

$ echo QlpoOTFBWSZTWTcImb8AAAAAAIAAoACAJpQKpCETF3JFOFCQNwiZvw== | base64 -d | lbzcat
lbzcat: stdin: stream CRC mismatch

Justin Lecher reported the following case to also trigger the bug:

$ lbzip2 -d patchutils-0.3.2.tar.bz2
lbzip2: "patchutils-0.3.2.tar.bz2": stream CRC mismatch

Work to fix this problem is in progress. Estimated time of arrival: January 2012. For impatient there is a workaround available:

diff --git a/src/lbunzip2.c b/src/lbunzip2.c
index 113be47..67579ea 100644
--- a/src/lbunzip2.c
+++ b/src/lbunzip2.c
@@ -1453,7 +1453,7 @@ mux(struct w2m_q *w2m_q, struct m2s_q *m2s_q, struct files
         if (w2m_blk->bs100k) {
           bs100k = w2m_blk->bs100k;
           any |= (9u >= bs100k);
-          if (crc != w2m_blk->crc)
+          if (0 && crc != w2m_blk->crc)
             log_fatal("%s: %s%s%s: stream CRC mismatch\n", pname, ispec->sep,
                 ispec->fmt, ispec->sep);
           crc = 0u;
@kjn kjn was assigned
@jlec

Thanks, applied in gentoo now.

@kjn kjn referenced this issue from a commit
@kjn Workaround bug #5
* src/lbunzip2.c (mux): Disable stream CRC check. Fixes #5.
* tests/Makefile.am: Exclude crc1.bz2 from test cases.
ea9c980
@kjn kjn closed this issue from a commit
@kjn Workaround bug #5
* src/lbunzip2.c (mux): Disable stream CRC check. Fixes #5.
* tests/Makefile.am: Exclude crc1.bz2 from test cases.
ea9c980
@kjn kjn closed this in ea9c980
@kjn kjn reopened this
@kjn kjn referenced this issue from a commit
@kjn Fix bug #5
* src/lbunzip2.c (work_decompr): Assign w2w_blk->bs100k
to w2m_blk->bs100k only if YB_OK == ybret. Fixes: #5. This bug caused
files with input blocks larger than 1 MiB to be rejected by lbunzip2.
* tests/ch255.bz2: Add as a regression test for bug #5.
* tests/Makefile.am: Re-enable crc1.bz2, add ch255.bz2.
b0808ca
@kjn
Owner
kjn commented

I believe this bug is fixed now, but I will do more testing before ultimately closing it.

@kjn kjn referenced this issue from a commit
@kjn Add a patch to fix upstream bug #5 c52d02e
@kjn kjn closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.