Problem with iostreams and zlib
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_streambufboost::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/616919...
participants (1)
-
Alfred Kohl