I'm trying to use boost::iostreams(1.53.0) to uncompress a HTTP request body and later process it. But I get a crash when I run the following code.
try {
using namespace boost::iostreams;
ifstream file(argv[1], std::ios_base::in | std::ios_base::binary);
boost::iostreams::filtering_istream in;
in.push(gzip_decompressor());
in.push(file);
std::stringstream strstream;
boost::iostreams::copy(in, strstream);
} catch (std::exception& e) {
cout << e.what() << endl;
}
The crash occurs in gzip_decompressor()
, more specifically in gzip_header() { reset(); }
from boost's gzip.hpp (by looking at the call stack).
I have compiled myself the boost::iostreams library and also tried to use boost from macports, but the same crash occurs. I also tried using the gzstream library, but that crashes also in a constructor, more specifically in the constructor of igzstream
.
I tend to believe that this is a zlib-related problem. I didn't specify, I'm using a MacBook Pro with Mountain Lion and xCode 4.6 to build and run the code.
Did any of you encounter such a problem before?