certain jpeg causes undue resource consumption

Bug #704531 reported by Mark Foster
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
ImageMagick
Invalid
Undecided
Unassigned
imagemagick (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: imagemagick

Something about the attached jpeg (zzzbad1.jpeg) causes imagemagick (display, convert) to go bonkers. It creates a 4.1GB file in /tmp/magick-XXXXXXXX

Try download the jpeg and run 'display zzzbad1.jpeg'

Revision history for this message
Mark Foster (fostermarkd) wrote :
Revision history for this message
Mark Foster (fostermarkd) wrote :
Revision history for this message
Mark Foster (fostermarkd) wrote :

mdf@sushi ~ $ apt-cache policy imagemagick
imagemagick:
  Installed: 7:6.6.2.6-1ubuntu1.1
  Candidate: 7:6.6.2.6-1ubuntu1.1
  Version table:
 *** 7:6.6.2.6-1ubuntu1.1 0
        500 http://archive.ubuntu.com/ubuntu/ maverick-updates/main i386 Packages
        500 http://security.ubuntu.com/ubuntu/ maverick-security/main i386 Packages
        100 /var/lib/dpkg/status
     7:6.6.2.6-1ubuntu1 0
        500 http://archive.ubuntu.com/ubuntu/ maverick/main i386 Packages

Revision history for this message
broucaries (roucaries-bastien+bugs) wrote :

Yes I think so it should only use 512M of ram

Revision history for this message
broucaries (roucaries-bastien+bugs) wrote :
Changed in imagemagick:
status: New → Confirmed
Revision history for this message
Cristy (78luphr0rnk2nuqimstywepozxn9kl19tqh0tx66b5-p1nbh7og5-a811i2i3ytqlsztthjth0svbccw8inm65tmkqp9sar) wrote :

ImageMagick is behaving properly. The zzzbad1.jpeg image is 26400x20400 pixels and as described in the architecture document @ http://www.imagemagick.org/script/architecture.php, image pixels are sometimes cached to disk if memory resources are consumed. The user could try increasing the area limit which might permit the image to be processed in memory:

  export MAGICK_AREA_LIMIT=12gb
  convert zzzbad1.jpeg zzzbad1.png

You can also reduce the memory requirements significantly if you use the Q8 (8-bits per pixel) version of ImageMagick instead of the default Q16 build.

We were able to convert the image from JPEG to PNM in memory on our 4GB Fedora host in just under 20 seconds.

Now displaying is a different beast. ImageMagick asks libX11 for a 26400x20400 pixmap and it may have trouble allocating the memory. You could force ImageMagick to cache the pixels to disk which permits libX11 to allocate the remaining real / virtual memory:

  display -limit area 0 zzzbad1.jpg

This failed gracefully for us on our 8GB Linux host with an X11 exception:

  display -limit area 0 zzzbad1.jpeg
  XIO: fatal IO error 14 (Bad address) on X server ":0"
  after 11687 requests (1482 known processed) with 36 events remaining.

However, this worked:

  display -limit area 0 -resize 50% zzzbad1.jpeg

Changed in imagemagick (Ubuntu):
status: New → Invalid
Changed in imagemagick:
status: Confirmed → Invalid
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.