Boost logo

Boost Users :

Subject: [Boost-users] iostreams gzip/zlib: different behavior with msvc 32 bit vs 64 bit (boost 1.53)
From: Simon Haegler (shaegler_at_[hidden])
Date: 2015-01-07 12:05:29


dear boost users

if i compile & run the test code below with msvc 2010 SP1 *64 bit*, both
variants (gzip/zlib) work as expected. however, compiling the same with
msvc 2010 SP1 *32 bit*, the gzip_decompressor aborts with

Assertion failed: 0, file libs\iostreams\src\gzip.cpp, line 127

looking at the debug stack trace, the decompressor chokes on some header
byte.
i tested with boost 1.53. did anybody encounter the same?

TIA,
simon

here is my test code:

BOOST_AUTO_TEST_SUITE(CompressionTests)

const std::string SOME_DATA = "yadda yadda duh";

BOOST_AUTO_TEST_CASE(boost_zlib) {
     const std::string p = "C:\\temp\\compressed.zlib";

     {
         boost::iostreams::filtering_ostream out;
         out.push(boost::iostreams::zlib_compressor());
         out.push(boost::iostreams::file_sink(p, std::ios_base::binary));
         out << SOME_DATA;
         boost::iostreams::close(out);
     }

     std::string result;
     {
         boost::iostreams::filtering_istream in;
         in.push(boost::iostreams::zlib_decompressor());
         in.push(boost::iostreams::file_source(p, std::ios_base::binary));
         result.assign((std::istreambuf_iterator<char>(in)),
(std::istreambuf_iterator<char>()));
         boost::iostreams::close(in);
     }

     BOOST_CHECK_EQUAL(result, SOME_DATA);
}

BOOST_AUTO_TEST_CASE(boost_gzip) {
     const std::string p = "C:\\temp\\compressed.gzip";

     {
         boost::iostreams::filtering_ostream out;
         out.push(boost::iostreams::gzip_compressor());
         out.push(boost::iostreams::file_sink(p, std::ios_base::binary));
         out << SOME_DATA;
         boost::iostreams::close(out);
     }

     std::string result;
     {
         boost::iostreams::filtering_istream in;
         in.push(boost::iostreams::gzip_decompressor());
         in.push(boost::iostreams::file_source(p, std::ios_base::binary));
         result.assign((std::istreambuf_iterator<char>(in)),
(std::istreambuf_iterator<char>()));
         boost::iostreams::close(in);
     }

     BOOST_CHECK_EQUAL(result, SOME_DATA);
}

BOOST_AUTO_TEST_SUITE_END()


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