Subject: bin/25508: NetBSD's gzip -t behaviour on corrupted gzip files
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <seb@netbsd.org>
List: netbsd-bugs
Date: 05/09/2004 12:13:14
>Number:         25508
>Category:       bin
>Synopsis:       NetBSD's gzip behaviour on corrupted gzip files
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun May 09 10:14:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Stoned Elipot
>Release:        NetBSD 2.0E
>Organization:
>Environment:
System: NetBSD runabout 2.0E NetBSD 2.0E (RUNABOUT) #0: Fri May 7 21:02:16 CEST 2004 seb@runabout:/u/seb/src/RUNABOUT/kernel/compile i386
Architecture: i386
Machine: i386
>Description:
NetBSD's gzip behaves strangely when processing corrupted (truncated)
files: it seems to be "looping" and has to be interrupted.
>How-To-Repeat:
$ dd if=/u/distfiles/emacs-21.3.tar.gz bs=1024 count=2 > foo.gz 
2+0 records in
2+0 records out
2048 bytes transferred in 0.001 secs (2048000 bytes/sec)
$ /usr/bin/gzip -V                                              
NetBSD gzip 20040427
$ /tmp/gnu-gzip -V                                              
gnu-gzip 1.2.4 (18 Aug 93)
Compilation options:
DIRENT UTIME STDC_HEADERS HAVE_UNISTD_H ASMV 
$ time /tmp/gnu-gzip -d foo.gz                                  

gnu-gzip: foo.gz: unexpected end of file
    0.00s real     0.01s user     0.01s system
$ echo $?
1
$ time /usr/bin/gzip -d foo.gz                                  
^C   50.85s real    20.40s user    29.46s system

$ rm foo
$ ktrace /usr/bin/gzip -d foo.gz  
^C
$ kdump |tail -20                 
  9366 gzip     RET   write 0
  9366 gzip     CALL  write(4,0xcfbeeab0,0)
  9366 gzip     RET   write 0
  9366 gzip     CALL  write(4,0xcfbeeab0,0)
  9366 gzip     RET   write 0
  9366 gzip     CALL  write(4,0xcfbeeab0,0)
  9366 gzip     RET   write 0
  9366 gzip     CALL  write(4,0xcfbeeab0,0)
  9366 gzip     RET   write 0
  9366 gzip     CALL  write(4,0xcfbeeab0,0)
  9366 gzip     RET   write 0
  9366 gzip     CALL  write(4,0xcfbeeab0,0)
  9366 gzip     RET   write 0
  9366 gzip     CALL  write(4,0xcfbeeab0,0)
  9366 gzip     RET   write 0
  9366 gzip     CALL  write(4,0xcfbeeab0,0)
  9366 gzip     RET   write 0
  9366 gzip     CALL  write(4,0xcfbeeab0,0)
  9366 gzip     RET   write 0
  9366 gzip     PSIG  SIGINT SIG_DFL
$
>Fix:
None provided.
>Release-Note:
>Audit-Trail:
>Unformatted: