kjn/lbzip2 — Issue #5: fails to chech stream CRC
Author: kjn
Created: 2011-11-28 11:30:24+00:00
State: open

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;
```