diff options
| author | Joakim Tjernlund <Joakim.Tjernlund@transmode.se> | 2010-02-08 18:55:15 +0100 | 
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-02-11 23:56:48 +0100 | 
| commit | 0866b369003fbf81f8f35eb15360a628b3f3aa9a (patch) | |
| tree | 2c1281842f3c91e822268045b57d7c9aadacdee6 | |
| parent | 80f4275629bd7f73776018cb3d06773a413bbbfb (diff) | |
| download | busybox-0866b369003fbf81f8f35eb15360a628b3f3aa9a.tar.gz | |
gunzip: inflate_codes(): add fix from upstream gzip to prevent false CRC error
Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| -rw-r--r-- | archival/libunarchive/decompress_unzip.c | 5 | 
1 files changed, 4 insertions, 1 deletions
| diff --git a/archival/libunarchive/decompress_unzip.c b/archival/libunarchive/decompress_unzip.c index feaa047bd..33e877ec8 100644 --- a/archival/libunarchive/decompress_unzip.c +++ b/archival/libunarchive/decompress_unzip.c @@ -575,13 +575,16 @@ static NOINLINE int inflate_codes(STATE_PARAM_ONLY)  			do {  				/* Was: nn -= (e = (e = GUNZIP_WSIZE - ((dd &= GUNZIP_WSIZE - 1) > w ? dd : w)) > nn ? nn : e); */  				/* Who wrote THAT?? rewritten as: */ +				unsigned delta; +  				dd &= GUNZIP_WSIZE - 1;  				e = GUNZIP_WSIZE - (dd > w ? dd : w); +				delta = w > dd ? w - dd : dd - w;  				if (e > nn) e = nn;  				nn -= e;  				/* copy to new buffer to prevent possible overwrite */ -				if (w - dd >= e) {	/* (this test assumes unsigned comparison) */ +				if (delta >= e) {  					memcpy(gunzip_window + w, gunzip_window + dd, e);  					w += e;  					dd += e; | 
