Subject: [Boost-bugs] [Boost C++ Libraries] #6994: gzip_decompressor issue with unusual files
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-06-18 08:48:13
#6994: gzip_decompressor issue with unusual files
---------------------------------------------------+------------------------
Reporter: Gavin Band <gavinband@â¦> | Owner: turkanis
Type: Bugs | Status: new
Milestone: To Be Determined | Component: iostreams
Version: Boost 1.49.0 | Severity: Problem
Keywords: gzip gzip_decompressor |
---------------------------------------------------+------------------------
The gzip_decompressor implementation fails on gzip files that contain an
empty block after a non-empty one. (You can make such a file by gzipping
a nonempty and an empty file and concatenating them, but they are also
sometimes written by other tools.) Here such a file:
$ hexdump -C hello.txt.gz
00000000 1f 8b 08 00 0d ea b4 4f 00 03 cb 48 cd c9 c9 57
|.......O...H...W|
00000010 28 c9 48 2d 4a e5 02 00 8e 45 d1 59 0c 00 00 00
|(.H-J....E.Y....|
00000020 1f 8b 08 00 18 ea b4 4f 00 03 03 00 00 00 00 00
|.......O........|
00000030 00 00 00 00 |....|
00000034
My file reading code is:
/* test.cpp */
#include <iostream>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/device/file.hpp>
int main( int, char** ) {
boost::iostreams::filtering_istream stream ;
stream.push( boost::iostreams::gzip_decompressor() ) ;
boost::iostreams::file_source file( argv[1] ) ;
stream.push( file ) ;
boost::iostreams::copy( stream, std::cout ) ;
}
Using gunzip on the above file works fine:
$ gunzip -c ../hello.txt.bgz
Hello, this is a test file.
Using the test program does not:
$ ./test ../hello.txt.bgz
terminate called after throwing an instance of
'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::iostreams::gzip_error>
>'
what(): gzip error
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6994> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:09 UTC