Page 1 of 1

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

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

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

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

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

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

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

Posted: 2015-02-28T19:33:10-07:00
by JodieC
Can you confirm these 2 for this issue?

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

Posted: 2015-03-01T11:07:49-07:00
by dlemstra
17845 is for IM7 and 17846 is for IM6. You most likely only need the latter.