|
Boost Users : |
Subject: [Boost-users] Problem with iostreams and zlib
From: Alfred Kohl (alfred.kohl_at_[hidden])
Date: 2008-09-09 09:00:04
Hi!
the gzip_decompressor sometimes fails with Z_BUF_ERROR wrapped in zlib_error().
I'm using boost-1.36.0 and zlib-1.2.3, both statically linked.
Stream setup is as follows:
std::ifstream filein("testfile");
boost::iostreams::filtering_streambuf<boost::iostreams::input> strbuf;
strbuf.push(boost::iostreams::gzip_decompressor());
strbuf.push(filein);
std::istream input(&strbuf);
do
{
char buf[4096];
input.read(&buf, 4096);
} while (input.gcount() > 0);
For one particular file, read() will fail after reading about 2 MB (of 3 MB total file size). The file decompresses fine with external tools and contains mainly zeros.
The error happens in (boost/iostreams/filter/zlib.hpp):
bool zlib_decompressor_impl<Alloc>::filter
( const char*& src_begin, const char* src_end,
char*& dest_begin, char* dest_end, bool /* flush */ )
{
before(src_begin, src_end, dest_begin, dest_end);
int result = inflate(zlib::sync_flush);
after(src_begin, dest_begin, false);
zlib_error::check(result); // <---
return result != zlib::stream_end;
}
src_begin and src_end both point to the same location! I'm not an expert with zlib but this looks wrong to me...
Re-compressing the file with an external tool does not help.
Any ideas?
Cheers,
Alfred.
-- GMX Kostenlose Spiele: Einfach online spielen und Spaß haben mit Pastry Passion! http://games.entertainment.gmx.net/de/entertainment/games/free/puzzle/6169196
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net