Subject: [Boost-bugs] [Boost C++ Libraries] #5584: gzip_decompressor sometimes truncates data
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-05-31 18:57:15
#5584: gzip_decompressor sometimes truncates data
------------------------------------------------+---------------------------
Reporter: Hans-Andreas Engel <engel@â¦> | Owner:
Type: Bugs | Status: new
Milestone: To Be Determined | Component: None
Version: Boost 1.41.0 | Severity: Problem
Keywords: |
------------------------------------------------+---------------------------
Th following trivial sample program `boost_gunzip.cc` only decompresses
files partially. This issue only appears for a minority of the files.
{{{
#include <boost/iostreams/device/file.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <iostream>
#include <ios>
int main(int argc, const char *argv[]) {
if (argc != 2) {
std::cerr << "need exactly one argument" << std::endl;
return 1;
}
boost::iostreams::filtering_istream in;
in.push(boost::iostreams::gzip_decompressor());
in.push(boost::iostreams::file_source(argv[1],
std::ios_base::in | std::ios_base::binary));
while (in.good()) {
char c = in.get();
if (in.good()) std::cout << c;
}
};
}}}
In the following example, `gzip_decompressor` misses 113 bytes:
{{{
~$ cat <(for i in `seq 0 100`; do echo 'Mon May 30 23:17:43 EDT 2011';
done) > /tmp/a
~$ md5sum /tmp/a
040fce9cef21c343fd9ab2aecf1515e3 /tmp/a
~$ wc -c /tmp/a
2929 /tmp/a
~$ gzip /tmp/a
~$ md5sum /tmp/a.gz
46bd5683f86075e30124c5a6a1d2f83d /tmp/a.gz
~$ zcat /tmp/a.gz | wc -c
2929
~$ ./boost_gunzip /tmp/a.gz | wc -c
2816
}}}
This is on a RHEL 6.1 64bit system, i.e., using `boost-
iostreams-1.41.0-11.el6.x86_64`.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/5584> 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:06 UTC