[Boost-bugs] [Boost C++ Libraries] #3348: SEGV in ~bzip2_decompressor()

Subject: [Boost-bugs] [Boost C++ Libraries] #3348: SEGV in ~bzip2_decompressor()
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-08-17 15:43:07


#3348: SEGV in ~bzip2_decompressor()
-----------------------------+----------------------------------------------
 Reporter: basilevs@… | Owner: turkanis
     Type: Bugs | Status: new
Milestone: Boost 1.40.0 | Component: iostreams
  Version: Boost 1.39.0 | Severity: Problem
 Keywords: |
-----------------------------+----------------------------------------------
 Destructor of unused bzip2_decompressor instance causes segmentation
 violation.

 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).

 The problem appears with bzip2-1.0.5 compiled with mingw (gcc (GCC) 3.4.5
 (mingw-vista special r3)).

 A quick fix for this problem would be a test for !ready_ before calling of
 any BZ2_bz*compressEnd(s) functions.

 I've added the line

 if (!ready_) return;

 in the very beginning of function void bzip2_base::end(bool compress) in
 bzip2.cpp and SEGVs dissapeared.

 A patch is attached. Beware incorrect directory naming in the patch file.

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