Excessive CPU in HDR image - IM6 SVN - convert - 3c1c3e63

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
JodieC
Posts: 82
Joined: 2014-10-03T21:38:50-07:00
Authentication code: 6789

Excessive CPU in HDR image - IM6 SVN - convert - 3c1c3e63

Post by JodieC »

Source file:
https://www.dropbox.com/s/o2dwadu5ti11nwn/3c1c3e63?dl=0

To reproduce:
limit cpu to n seconds via

Code: Select all

ulimit -St 600
Then run

Code: Select all

convert 3c1c3e63 null: 
or

Code: Select all

identify 3c1c3e63
Output:
With the ulimit:
Aborted
Without the ulimit:
No output... It just runs for hours.

I don't have a handy BT on this right now, but I did run it through valgrind --tool=callgrind for about 20-30 seconds or so. When I pulled it into kcachegrind it apparently spent 800K calls in ReadHDRImage and 500K to ReadBlobByte. :shock: That's a lot for a <1KB file.

I'm running on Im6 from SVN rev17767.

System Details:
AMD64
Distributor ID: Ubuntu
Description: Ubuntu 14.04.1 LTS
Release: 14.04
Codename: trusty

Found with American Fuzzy Lop ( http://lcamtuf.coredump.cx/afl/ )
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Excessive CPU in HDR image - IM6 SVN - convert - 3c1c3e63

Post by dlemstra »

I submitted a patch to fix this infinite loop. It now quits with the following message:

Code: Select all

D:\Images\Fuzz>identify 3c1c3e63
identify.exe: Improper image header `3c1c3e63' @ error/hdr.c/ReadHDRImage/379.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
JodieC
Posts: 82
Joined: 2014-10-03T21:38:50-07:00
Authentication code: 6789

Re: Excessive CPU in HDR image - IM6 SVN - convert - 3c1c3e63

Post by JodieC »

Dirk:
Thanks for the patch. I have some others that are similar that I'll get submitted.


For Bastien:
The patches for this are in:
http://trac.imagemagick.org/changeset/17845
http://trac.imagemagick.org/changeset/17846
JodieC
Posts: 82
Joined: 2014-10-03T21:38:50-07:00
Authentication code: 6789

Re: Excessive CPU in HDR image - IM6 SVN - convert - 3c1c3e63

Post by JodieC »

Can you confirm these 2 for this issue?
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Excessive CPU in HDR image - IM6 SVN - convert - 3c1c3e63

Post by dlemstra »

17845 is for IM7 and 17846 is for IM6. You most likely only need the latter.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
Post Reply