[BusyBox 0001146]: gunzip broken in SVN

bugs at busybox.net bugs at busybox.net
Wed Jan 10 12:51:57 PST 2007


The following issue has been CLOSED 
====================================================================== 
http://busybox.net/bugs/view.php?id=1146 
====================================================================== 
Reported By:                espakman
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   1146
Category:                   Other
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     closed
Resolution:                 open
Fixed in Version:           
====================================================================== 
Date Submitted:             01-08-2007 14:47 PST
Last Modified:              01-10-2007 12:51 PST
====================================================================== 
Summary:                    gunzip broken in SVN
Description: 
In the current SVN version of busybox, gunzip is broken.
Testcase:
# ./busybox gunzip uClibc-0.9.28.tar.gz
gunzip: crc error
gunzip: error inflating

====================================================================== 

---------------------------------------------------------------------- 
 vda - 01-09-07 15:58  
---------------------------------------------------------------------- 
Just compiled svn, and:

# wget
http://debian.csail.mit.edu/pub/linux/libs/uclibc/uClibc-0.9.28.tar.gz
Connecting to debian.csail.mit.edu[128.30.2.36]:80
uClibc-0.9.28.tar.gz 100% |************************************|  2352 KB
00:00:00 ETA
# ./busybox gunzip uClibc-0.9.28.tar.gz

Please give URL to uClibc-0.9.28.tar.gz you use for testing and attach
your config. 

---------------------------------------------------------------------- 
 rockeychu - 01-10-07 06:41  
---------------------------------------------------------------------- 
Indeed, since revision 17168, gunzip is broken by uninitialized variables
of "n" and "d". (Only first 32kB data is OK, that is, any file size <=32kB
is OK). 

The following patch solves this BUG:

Index: archival/libunarchive/decompress_unzip.c
===================================================================
--- archival/libunarchive/decompress_unzip.c    (revision 17224)
+++ archival/libunarchive/decompress_unzip.c    (working copy)
@@ -479,6 +479,7 @@
 {
        unsigned e;     /* table entry flag/number of extra bits */
        huft_t *t;      /* pointer to table entry */
+       static unsigned n, d;   /* length and index for copy */

        if (resume_copy) goto do_copy;

@@ -510,10 +511,6 @@
                                return 1; // We have a block to read
                        }
                } else {                /* it's an EOB or a length */
-                       /* length and index for copy */
-                       unsigned n = n; /* for gcc */
-                       unsigned d = d; /* for gcc */
-
                        /* exit if end of block */
                        if (e == 15) {
                                break; 

---------------------------------------------------------------------- 
 vda - 01-10-07 12:51  
---------------------------------------------------------------------- 
fixed in 17230, thanks you for excellent debug work guys! 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
01-08-07 14:47  espakman       New Issue                                    
01-08-07 14:47  espakman       Status                   new => assigned     
01-08-07 14:47  espakman       Assigned To               => BusyBox         
01-09-07 15:58  vda            Note Added: 0001976                          
01-10-07 06:41  rockeychu      Note Added: 0001982                          
01-10-07 12:51  vda            Status                   assigned => closed  
01-10-07 12:51  vda            Note Added: 0001983                          
======================================================================



More information about the busybox-cvs mailing list