Opened 14 years ago
Closed 12 years ago
#2783 closed Bugs (fixed)
bzip2_decompressor infinite loops with truncated input file
Reported by: | Owned by: | Jonathan Turkanis | |
---|---|---|---|
Milestone: | Component: | iostreams | |
Version: | Boost 1.38.0 | Severity: | Problem |
Keywords: | Cc: |
Description
Hi. This is a re-report of a problem posted to boost-users in 2005, http://lists.boost.org/boost-users/2005/10/14361.php
I have attached the sample program from that post.
To reproduce:
echo -e "Hello world\n" | bzip2 > hello-complete.bz2 dd if=hello-complete.bz2 of=hello.bz2 bs=1 count=53 ./hello
The program never terminates.
This behaviour is exhibited with both gcc 4.3 and VC8 using latest boost release.
TIA.
Attachments (2)
Change History (6)
by , 14 years ago
by , 14 years ago
comment:1 by , 13 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 13 years ago
I disagree. (As does Jonathan Turkanis - http://lists.boost.org/boost-users/2005/10/14362.php).
The correct behaviour is to throw an exception (probably boost::iostreams::data_error) (like the gzip filter does) - infinite looping with invalid input really isn't good. Just like bzip2 reports the file is corrupt, so should this filter.
comment:3 by , 13 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
Ok, fair point. (Thats an embarassing start...)
comment:4 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Is this a valid test/error?
bzip2 reports that hello.bz2 is corrupt.
You can use the `bzip2recover' program to attempt to recover data from undamaged sections of corrupted files.
It works fine once recovered.
But then this isnt a Boost issue.
Tested on:
BOOST_VERSION: 103800 BOOST_LIB_VERSION: 1_38
gcc -v:- Using built-in specs. Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-cxa_atexit --disable-libunwind-exceptions --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-cpu=generic --build=x86_64-redhat-linux Thread model: posix gcc version 4.3.2 20081105 (Red Hat 4.3.2-7) (GCC)
Linux 2.6.27.24-170.2.68.fc10.x86_64 #1 SMP x86_64 GNU/Linux