Boost C++ Libraries: Ticket #3348: SEGV in ~bzip2_decompressor() https://svn.boost.org/trac10/ticket/3348 <p> Destructor of unused bzip2_decompressor instance causes segmentation violation. </p> <p> Function bzip2_base::end() is called from destructor without checking whether function bzip2_base::do_init() was called earlier. This causes a call to BZ2_bzDecompressEnd(s) without preceding call to BZ2_bzDecompressInit(s, 0, params_.small). </p> <p> The problem appears with bzip2-1.0.5 compiled with mingw (gcc (GCC) 3.4.5 (mingw-vista special <a class="changeset" href="https://svn.boost.org/trac10/changeset/3" title="Tweak disclaimer text">r3</a>)). </p> <p> A quick fix for this problem would be a test for !ready_ before calling of any BZ2_bz*compressEnd(s) functions. </p> <p> I've added the line </p> <p> if (!ready_) return; </p> <p> in the very beginning of function void bzip2_base::end(bool compress) in bzip2.cpp and SEGVs dissapeared. </p> <p> A patch is attached. Beware incorrect directory naming in the patch file. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3348 Trac 1.4.3 basilevs@… Mon, 17 Aug 2009 15:44:58 GMT attachment set https://svn.boost.org/trac10/ticket/3348 https://svn.boost.org/trac10/ticket/3348 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">bzip2.patch</span> </li> </ul> <p> Adds a check for ready_ before calling of BZ2_bz*ompressEnd() functions. </p> Ticket basilevs@… Mon, 17 Aug 2009 15:48:00 GMT attachment set https://svn.boost.org/trac10/ticket/3348 https://svn.boost.org/trac10/ticket/3348 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">bzip2_test.cpp</span> </li> </ul> <p> This sample program demonstrates the SEGV at the end of main() fucntion. </p> Ticket Gulevich Vasili <basilevs@…> Sun, 30 Aug 2009 17:48:01 GMT <link>https://svn.boost.org/trac10/ticket/3348#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3348#comment:1</guid> <description> <p> The same error happens on Linux with g++ (Debian 4.3.4-1), bzlib 1.0.5, boost-1.38. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 16 Sep 2009 10:57:04 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3348#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3348#comment:2</guid> <description> <p> The trunk still has this problem. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Steven Watanabe</dc:creator> <pubDate>Tue, 15 Jun 2010 01:22:53 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/3348#comment:3 https://svn.boost.org/trac10/ticket/3348#comment:3 <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/62962" title="Make sure that the bzip2 filters can be closed even if no input has ...">[62962]</a>) Make sure that the bzip2 filters can be closed even if no input has been read. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3348" title="#3348: Bugs: SEGV in ~bzip2_decompressor() (closed: fixed)">#3348</a>. </p> Ticket