[Boost-bugs] [Boost C++ Libraries] #12471: gzip compressor decompressor broken

Subject: [Boost-bugs] [Boost C++ Libraries] #12471: gzip compressor decompressor broken
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-09-20 14:40:52


#12471: gzip compressor decompressor broken
------------------------------+-----------------------
 Reporter: anonymous | Owner: turkanis
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: iostreams
  Version: Boost 1.61.0 | Severity: Problem
 Keywords: |
------------------------------+-----------------------
 Hi guys, when I use the iostreams with the gzip tools it fails to give
 correct answers on final dezip. my data is all small integers separated by
 commas, and the recovered data interchanges the order of commas and
 numbers as if it was a bad multithreaded program. The result is worse than
 useless. This is a big file phenomena (up to gb size).

 Looking at the compressor code (gzip.hpp) I see many problems between 32
 and 64 bit. Currently I am looking at an assignment:
 One that is problematic at the
 {{{
     template<typename Sink>
     std::streamsize write(Sink& snk, const char_type* s, std::streamsize
 n)
     {
         if (!(flags_ & f_header_done)) {
             std::streamsize amt =
                 static_cast<std::streamsize>(header_.size() - offset_);
             offset_ += boost::iostreams::write(snk, header_.data() +
 offset_, amt);
             if (offset_ == header_.size())
                 flags_ |= f_header_done;
             else
                 return 0;
         }
         return base_type::write(snk, s, n);
     }
 }}}
 offset_ is size_t while boost::iostreams::write(returns streamsize a
 signed 64 bit type (long long). So in 32 bit code there is a problem.
 Streamsize occurs many places, as does size_t; but one seems to be
 consistently 64 bit across platforms. offset seems to be 32 bit in 32 bit
 code.
 I do not think this this is the cause of the issues with gzip but short of
 rewriting it I don't know where to start.

 I would like ot use and have confidence in this compression code but so
 far it only gives grief...

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12471>
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:20 UTC