Boost C++ Libraries: Ticket #2318: A particular string for which compressing/uncompressing using iostreams/zlib fails. https://svn.boost.org/trac10/ticket/2318 <p> Found a string that compressing and than uncompressing using iostreams and zlib results in an exception being thrown by the uncompress operation. (The same code works fine for all other strings tried). Attaching a sample program + file containing the problematic string. </p> <p> Not sure if this helps - but take note that the resulting compressed buffer has the pretty unusual size of 20480, which might be a multiple of some constant. A number of different strings which compress to this size however didn't exhibit the same behavior. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/2318 Trac 1.4.3 guy_tannenbaum@… Thu, 11 Sep 2008 07:12:55 GMT attachment set https://svn.boost.org/trac10/ticket/2318 https://svn.boost.org/trac10/ticket/2318 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">strange_zlib.cpp</span> </li> </ul> <p> program which generates the behavior </p> Ticket guy_tannenbaum@… Thu, 11 Sep 2008 07:14:05 GMT attachment set https://svn.boost.org/trac10/ticket/2318 https://svn.boost.org/trac10/ticket/2318 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">short_magic.txt</span> </li> </ul> <p> problematic string (each line is the ascii code of one char) </p> Ticket guy_tannenbaum@… Thu, 11 Sep 2008 07:22:09 GMT <link>https://svn.boost.org/trac10/ticket/2318#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2318#comment:1</guid> <description> <p> Found this on Boost 1.35.0 (not 1.36.0) </p> </description> <category>Ticket</category> </item> <item> <author>rbock@…</author> <pubDate>Tue, 14 Oct 2008 22:37:54 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/2318#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2318#comment:2</guid> <description> <p> Hi, </p> <p> I found the same problem in 1.36. It is rather rare: In 6.5Million compressed files in my project, it occurred only 441 times. As mentioned by Guy, the size of the damaged zip is a bit peculiar, all sizes I checked are multiples of 4096. </p> <p> Also, I think it is more related to filtering_istream and filtering_istreambuf than zlib_compression, as it works fine if you use filtering_ostream or filtering_ostreambuf instead. </p> <p> I am going to attach an extended example with similar code which does not work, too for the given example string and code which does (using filtering_ostream instead of filtering_istream for compression). </p> <p> I am also attaching a binary version of the sample data, since reading the ascii version did not work for me (I had to replace the lexical_cast by atoi to make it work). </p> <p> Here is some system information, if this should be required to reproduce the problem (and circumvention): </p> <p> Ubuntu 8.04 64bit, gcc 4.2.3, boost-1.36, zlib-1g 1.2.3.3 </p> <p> Please do not hesitate to ask for more information. Personally, I consider this a rather severe problem since it can impair data integrity in backups. Lucky me, my software is not in production yet :-) </p> <p> Regards, </p> <p> Roland </p> </description> <category>Ticket</category> </item> <item> <author>rbock@…</author> <pubDate>Tue, 14 Oct 2008 22:40:35 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/2318 https://svn.boost.org/trac10/ticket/2318 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">working_zlib.cpp</span> </li> </ul> <p> Variants of strange_zlib.cpp showing how to circumvent the problem (and another variant which does fail) </p> Ticket rbock@… Tue, 14 Oct 2008 22:43:07 GMT attachment set https://svn.boost.org/trac10/ticket/2318 https://svn.boost.org/trac10/ticket/2318 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">magic.bin</span> </li> </ul> <p> Binary version of short_magic.txt (easier to read into the program, I think, unless it is damaged by upload/download, md5sum: fd78968e81890bce3cee1c3054b700e9) </p> Ticket rbock@… Wed, 15 Oct 2008 00:16:21 GMT <link>https://svn.boost.org/trac10/ticket/2318#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2318#comment:3</guid> <description> <p> See also <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2411" title="#2411: Bugs: bzip2_compressor does not work with filtering_istream (closed: fixed)">#2411</a>, which shows that the same (or at least very similar) problem occurs for bzip2 compression, too (and much easier to reproduce). </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Steven Watanabe</dc:creator> <pubDate>Mon, 14 Jun 2010 19:59:47 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/2318#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2318#comment:4</guid> <description> <p> The compressed data is invalid because the stream is not properly ended. Still investigating. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Steven Watanabe</dc:creator> <pubDate>Mon, 14 Jun 2010 21:42:32 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/2318#comment:5 https://svn.boost.org/trac10/ticket/2318#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">new</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/62952" title="Don't end the stream produced by a reading through a symmetric_filter ...">[62952]</a>) Don't end the stream produced by a reading through a symmetric_filter prematurely. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2318" title="#2318: Bugs: A particular string for which compressing/uncompressing using ... (closed: fixed)">#2318</a>. </p> Ticket