memory leak in ImageMetadata.from_buffer

Bug #562525 reported by Michael
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pyexiv2
Fix Released
Critical
Olivier Tilloy

Bug Description

in pyexiv2 0.2.0 for Windows:

in the method

Image::Image(const std::string& buffer, long size)

the buffer gets copied to Exiv2::byte* data , but it is never deleted. You should store the pointer in the Image object, and delete it in ~Image();

The bug becomes obvious with the following little script. It causes out of memory error within 10 seconds:

###########################################################################
import pyexiv2, StringIO
from PIL import Image

def test():
    h = 500
    w = 500
    I = Image.new( "RGB", (w, h) )
    S = StringIO.StringIO( )
    I.save( S, "JPEG", quality = 95)
    jpg_data = S.getvalue()
    while 1:
        metadata = pyexiv2.ImageMetadata.from_buffer(jpg_data)

test()
###########################################################################

Thank you for this very useful module!

Related branches

Revision history for this message
Olivier Tilloy (osomon) wrote :

I can easily reproduce (on linux, this is not platform specific) with the provided test script.

Changed in pyexiv2:
importance: Undecided → Critical
status: New → Confirmed
Revision history for this message
Olivier Tilloy (osomon) wrote :

Fixed with revision 300.
Thanks for the report Michael!

Changed in pyexiv2:
assignee: nobody → Olivier Tilloy (osomon)
status: Confirmed → Fix Committed
Olivier Tilloy (osomon)
Changed in pyexiv2:
milestone: none → 0.2.1
Olivier Tilloy (osomon)
Changed in pyexiv2:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.