Boost C++ Libraries: Ticket #5584: gzip_decompressor sometimes truncates data https://svn.boost.org/trac10/ticket/5584 <p> Th following trivial sample program <code>boost_gunzip.cc</code> only decompresses files partially. This issue only appears for a minority of the files. </p> <pre class="wiki">#include &lt;boost/iostreams/device/file.hpp&gt; #include &lt;boost/iostreams/filtering_stream.hpp&gt; #include &lt;boost/iostreams/filter/gzip.hpp&gt; #include &lt;iostream&gt; #include &lt;ios&gt; int main(int argc, const char *argv[]) { if (argc != 2) { std::cerr &lt;&lt; "need exactly one argument" &lt;&lt; std::endl; return 1; } boost::iostreams::filtering_istream in; in.push(boost::iostreams::gzip_decompressor()); in.push(boost::iostreams::file_source(argv[1], std::ios_base::in | std::ios_base::binary)); while (in.good()) { char c = in.get(); if (in.good()) std::cout &lt;&lt; c; } }; </pre><p> In the following example, <code>gzip_decompressor</code> misses 113 bytes: </p> <pre class="wiki">~$ cat &lt;(for i in `seq 0 100`; do echo 'Mon May 30 23:17:43 EDT 2011'; done) &gt; /tmp/a ~$ md5sum /tmp/a 040fce9cef21c343fd9ab2aecf1515e3 /tmp/a ~$ wc -c /tmp/a 2929 /tmp/a ~$ gzip /tmp/a ~$ md5sum /tmp/a.gz 46bd5683f86075e30124c5a6a1d2f83d /tmp/a.gz ~$ zcat /tmp/a.gz | wc -c 2929 ~$ ./boost_gunzip /tmp/a.gz | wc -c 2816 </pre><p> This is on a RHEL 6.1 64bit system, i.e., using <code>boost-iostreams-1.41.0-11.el6.x86_64</code>. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5584 Trac 1.4.3 Hans-Andreas Engel <engel@…> Tue, 31 May 2011 18:58:31 GMT attachment set https://svn.boost.org/trac10/ticket/5584 https://svn.boost.org/trac10/ticket/5584 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">a.gz</span> </li> </ul> <p> Compressed file <code>a.gz</code> causing truncated reads </p> Ticket anonymous Mon, 13 Jun 2011 09:38:42 GMT <link>https://svn.boost.org/trac10/ticket/5584#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5584#comment:1</guid> <description> <p> Looks like this doesn't affect latest trunk. </p> <pre class="wiki">ivan@ivan-desktop:~/iostreams-test$ cat &lt;(for i in `seq 0 100`; do echo 'Mon May 30 23:17:43 EDT 2011'; done) &gt; a ivan@ivan-desktop:~/iostreams-test$ wc -c a 2929 a ivan@ivan-desktop:~/iostreams-test$ gzip a ivan@ivan-desktop:~/iostreams-test$ zcat a.gz | wc -c 2929 ivan@ivan-desktop:~/iostreams-test$ ./boost_gunzip a.gz | wc -c 2929 </pre><p> trunk <a class="changeset" href="https://svn.boost.org/trac10/changeset/72410" title="Spirit: adding conjure_lexer example, fixing a couple of lexer bugs">r72410</a>. ubuntu 11.04 x64 </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Steven Watanabe</dc:creator> <pubDate>Sun, 16 Oct 2011 18:21:49 GMT</pubDate> <title>component changed; owner set https://svn.boost.org/trac10/ticket/5584#comment:2 https://svn.boost.org/trac10/ticket/5584#comment:2 <ul> <li><strong>owner</strong> set to <span class="trac-author">Jonathan Turkanis</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">iostreams</span> </li> </ul> Ticket