Boost C++ Libraries: Ticket #5908: iostreams gzip fails to handle optional extra fields in gzip header https://svn.boost.org/trac10/ticket/5908 <p> When bit 2 (FEXTRA) is set in a gzip header's flags, the iostreams code fails to read the XLEN field before starting to read the extra comment. The code is actually there to do it, but it gets skipped. This means the code goes directly a loop like: while (--xlen != 0) with xlen still set to 0. This results in the rest of the file being slurped in by this comment reading code (or at least until xlen wraps around to 0 again, which could take awhile). I ran into this because many popular file formats in bioinformatics (BAM, tabix) are gzipped and include extra optional fields in their headers. </p> <p> I've attached an example gzipped file with an optional header, a test program that should demonstrate the problem (against 1.47 and latest svn), as well as a patch that fixes it. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5908 Trac 1.4.3 Travis Abbott <typedef.struct@…> Sat, 17 Sep 2011 21:34:28 GMT attachment set https://svn.boost.org/trac10/ticket/5908 https://svn.boost.org/trac10/ticket/5908 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">sample.txt.gz</span> </li> </ul> <p> gzip file with extra comment in header </p> Ticket Travis Abbott <typedef.struct@…> Sat, 17 Sep 2011 21:34:58 GMT attachment set https://svn.boost.org/trac10/ticket/5908 https://svn.boost.org/trac10/ticket/5908 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">example.cpp</span> </li> </ul> <p> test case that demonstrates the problem (run ./example sample.txt.gz) </p> Ticket Travis Abbott <typedef.struct@…> Sat, 17 Sep 2011 21:35:41 GMT attachment set https://svn.boost.org/trac10/ticket/5908 https://svn.boost.org/trac10/ticket/5908 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">iostreams-gzip.patch</span> </li> </ul> <p> patch that fixes the issue (patch -p0 &lt; iostreams-gzip.patch from top level of the repo) </p> Ticket typedef.struct@… Tue, 20 Dec 2011 21:27:31 GMT <link>https://svn.boost.org/trac10/ticket/5908#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5908#comment:1</guid> <description> <p> Seems like this is still present in 1.48 and current SVN. To be clear, the sample file is not empty. The desired output would be for the test program to read "hello there", but it gets nothing. You can compare to gzip -dc. The supplied patch still works with current SVN. </p> </description> <category>Ticket</category> </item> <item> <author>typedef.struct@…</author> <pubDate>Tue, 20 Dec 2011 22:28:16 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5908#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5908#comment:2</guid> <description> <p> Also worth mentioning is that this worked in 1.40, but when the ability to support multiple compressed objects in 1 gzipped stream was introduced, this bug appeared. </p> </description> <category>Ticket</category> </item> <item> <author>typedef.struct@…</author> <pubDate>Thu, 22 Dec 2011 21:25:07 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/5908 https://svn.boost.org/trac10/ticket/5908 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">iostreams-gzip_hdr_test.patch</span> </li> </ul> <p> second patch adding unit test to prevent future regressions. </p> Ticket typedef.struct@… Thu, 22 Dec 2011 21:26:54 GMT <link>https://svn.boost.org/trac10/ticket/5908#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5908#comment:3</guid> <description> <p> The test attached in the second patch (iostreams-gzip_hdr_test.patch) will fail with the current code, demonstrating the inability to parse certain types of RFC 1952 compliant gzip headers. Application of the first patch will cause the test to pass. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Jonathan Turkanis</dc:creator> <pubDate>Wed, 04 Jan 2012 04:52:01 GMT</pubDate> <title>status changed https://svn.boost.org/trac10/ticket/5908#comment:4 https://svn.boost.org/trac10/ticket/5908#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> I have applied the patches to trunk. </p> Ticket Daniel James Sun, 18 Mar 2012 13:47:03 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/5908#comment:5 https://svn.boost.org/trac10/ticket/5908#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/77368" title="Iostreams: Merge from trunk. - [74728] Eliminate unit_test_framework ...">[77368]</a>) Iostreams: Merge from trunk. </p> <ul><li><a class="changeset" href="https://svn.boost.org/trac10/changeset/74728" title="eliminated unit_test_framework and BOOST_MESSAGE">[74728]</a> Eliminate unit_test_framework and BOOST_MESSAGE. </li><li><a class="changeset" href="https://svn.boost.org/trac10/changeset/76301" title="applied patches from #5908">[76301]</a> Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5908" title="#5908: Bugs: iostreams gzip fails to handle optional extra fields in gzip header (closed: fixed)">#5908</a>. </li><li><a class="changeset" href="https://svn.boost.org/trac10/changeset/76941" title="Iostreams: Fix typos in comments. Refs #6530. ">[76941]</a> Fix typos in comments. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6530" title="#6530: Bugs: [iostreams]: typos in comments and documentation, part 1 (closed: fixed)">#6530</a>. </li><li><a class="changeset" href="https://svn.boost.org/trac10/changeset/76973" title="Iostreams: Fix test for latest Boost.Test changes.">[76973]</a> Remove extra semi-colons, which break with trunk Boost.Test. </li><li><a class="changeset" href="https://svn.boost.org/trac10/changeset/77174" title="Fix parameters for filter::close. Refs #6650. Also some markup fixes. ">[77174]</a> Fix parameters for filter::close. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6650" title="#6650: Bugs: Reversed parameter documentation for 2-parameter filter::close (closed: fixed)">#6650</a>. </li></ul> Ticket Smithc195 Fri, 06 Jan 2017 04:16:26 GMT status, severity, type, component, version, milestone changed; resolution deleted https://svn.boost.org/trac10/ticket/5908#comment:6 https://svn.boost.org/trac10/ticket/5908#comment:6 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>severity</strong> <span class="trac-field-old">Problem</span> → <span class="trac-field-new">Not Applicable</span> </li> <li><strong>type</strong> <span class="trac-field-old">Bugs</span> → <span class="trac-field-new">Library Submissions</span> </li> <li><strong>component</strong> <span class="trac-field-old">iostreams</span> → <span class="trac-field-new">xpressive</span> </li> <li><strong>version</strong> <span class="trac-field-old">Boost 1.47.0</span> → <span class="trac-field-new">Boost.Build-M3</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Website 1.X</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> </ul> <p> Hi. Only wanted to ask a quick issue. Now i am eaadkebdkckdgfgd </p> Ticket Daniel James Fri, 06 Jan 2017 11:38:34 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/5908#comment:7 https://svn.boost.org/trac10/ticket/5908#comment:7 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket Kohei Takahashi Sun, 08 Jan 2017 14:33:22 GMT type, version, component, severity, milestone changed https://svn.boost.org/trac10/ticket/5908#comment:8 https://svn.boost.org/trac10/ticket/5908#comment:8 <ul> <li><strong>type</strong> <span class="trac-field-old">Library Submissions</span> → <span class="trac-field-new">Bugs</span> </li> <li><strong>version</strong> <span class="trac-field-old">Boost.Build-M3</span> → <span class="trac-field-new">Boost 1.47.0</span> </li> <li><strong>component</strong> <span class="trac-field-old">xpressive</span> → <span class="trac-field-new">iostreams</span> </li> <li><strong>severity</strong> <span class="trac-field-old">Not Applicable</span> → <span class="trac-field-new">Problem</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">Website 1.X</span> → <span class="trac-field-new">To Be Determined</span> </li> </ul> Ticket