[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [BusyBox] bug#1265: patch which fixes the gunzip hang problem
From:       Matthias Lang <matthias () corelatus ! se>
Date:       2002-08-16 2:46:04
[Download RAW message or body]


Hi,

A simple way to test this bug is to test gunzip on all possible
truncations of a correct .gz file:

   > ls -l good.gz
   -rw-rw-r--    1 matthias matthias      894 Aug 16 09:54 good.gz

   for i in 0 1 2 3 4 5 6 7 8; do for j in 0 1 2 3 4 5 6 7 8 9; do for k in 0 1 2 3 4 \
5 6 7 8 9; do dd if=good.gz of=trunc.gz bs=1 count=$i$j$k; ./busybox gunzip -c \
trunc.gz > /dev/null; done; done;done

busybox 0.60.3 hangs on the majority of such truncated files. 

I modified unzip.c to check the return value of fgetc() in all cases
except those where it was obvious that an ignored EOF couldn't result
in a hang. The patch doesn't seem to make things larger or slower:

          0.60.3          patched
----------------------------------------------------------------------
Size:     191944          191944     (compiled out of the box for x86)
Speed:    2.6s            2.5s       (user + sys, on a 1M gzipped file)

Matt
---
http://www.corelatus.com


["gunzip_hang_fix.gz" (application/octet-stream)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic