[Bug 789] gunzip/bunzip2/zcat output corrupted

bugzilla at busybox.net bugzilla at busybox.net
Fri Dec 11 10:50:13 UTC 2009


--- Comment #3 from Denys Vlasenko <vda.linux at googlemail.com>  2009-12-11 10:50:10 UTC ---
(In reply to comment #2)
> (In reply to comment #1)
> > (In reply to comment #0)
> > What is "sparse data"? File with holes? Can you attach data.gz which is
> > producing errors when decompressed?
> Apologies.  I tried to upload in the original report, but 400k is too large an
> attachment for this Bugzilla.  I'm trying to find somewhere else to put the
> data...

Well, your 1st comment said "43.7K data.gz", can you attach that file?
If it is still too big, just email it to me.

> So the corruption is not always the same, but is far from random.  Examining
> the good and bad decompression results also showed them to differ in only one
> byte of the whole file.  
> Aside, I tried building busybox on i686 Linux and running gunzip on the
> troublesome file under Valgrind with the memchecker.  It was completely clean
> or warnings/errors in that scenario, and also correctly compressed/decompressed
> the data repeatedly.

What is the CPU and architecture where it fails? Is it big endian?
If it is not reproducible on x86, we may end up in situation when only you can
debug it.

In case it is just a case where we end up using an uninitialized variable
somewhere, one quick & dirty method to test this theory is to go to
decompress_unzip.c and add "= 0" / to every uninitialized local variable and
memset to 0 every local uninitialized array, like this:

static int huft_build(const unsigned *b, const unsigned n,
                           const unsigned s, const unsigned short *d,
                           const unsigned char *e, huft_t **t, unsigned *m)
        unsigned a = 0;
        unsigned c[BMAX + 1];
        unsigned eob_len = 0;
        unsigned f = 0;
        int g = 0;
        int htl = 0;

memset(c, 0, sizeof(c));

If this makes bug go away, we can hunt it down further.

Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the busybox-cvs mailing list