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 » 2015-01-24T22:16:06-07:00

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: 1567
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 » 2015-01-25T00:31:22-07:00

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 » 2015-01-25T07:12:19-07:00

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 » 2015-02-28T19:33:10-07:00

Can you confirm these 2 for this issue?

User avatar
dlemstra
Posts: 1567
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 » 2015-03-01T11:07:49-07:00

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