Modify

Opened 8 years ago

Closed 7 years ago

#3348 closed Bugs (fixed)

SEGV in ~bzip2_decompressor()

Reported by: basilevs@… Owned by: Jonathan Turkanis
Milestone: Boost 1.40.0 Component: iostreams
Version: Boost 1.39.0 Severity: Problem
Keywords: Cc:

Description

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.

Attachments (2)

bzip2.patch (326 bytes) - added by basilevs@… 8 years ago.
Adds a check for ready_ before calling of BZ2_bz*ompressEnd() functions.
bzip2_test.cpp (526 bytes) - added by basilevs@… 8 years ago.
This sample program demonstrates the SEGV at the end of main() fucntion.

Download all attachments as: .zip

Change History (5)

Changed 8 years ago by basilevs@…

Attachment: bzip2.patch added

Adds a check for ready_ before calling of BZ2_bz*ompressEnd() functions.

Changed 8 years ago by basilevs@…

Attachment: bzip2_test.cpp added

This sample program demonstrates the SEGV at the end of main() fucntion.

comment:1 Changed 8 years ago by Gulevich Vasili <basilevs@…>

The same error happens on Linux with g++ (Debian 4.3.4-1), bzlib 1.0.5, boost-1.38.

comment:2 Changed 8 years ago by anonymous

The trunk still has this problem.

comment:3 Changed 7 years ago by Steven Watanabe

Resolution: fixed
Status: newclosed

(In [62962]) Make sure that the bzip2 filters can be closed even if no input has been read. Fixes #3348.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jonathan Turkanis.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.