GM returns MagickFail, when raw profile length is 0.
Swiss army knife of image processing
Brought to you by:
bfriesen
When encouting a 'raw profile type' while reading a png file, the gm code always have a judgement that whether the profile length equals 0, if 0, return MagickFail. Howecer, if this profile is just a futile label, the gm could not process this file.
I suggest that the gm could return MagickTrue in png_read_raw_profile function when encounting profile length 0, without set this image profile. For myself, I have ecncoutered some png image which hold this problem.
Last edit: alien 2015-11-03
The calling code is not checking the return status from png_read_raw_profile(). The error returned to the user is due to a CoderError exception being thrown at line 1150 of png.c. Perhaps it would work better if a warning was thrown instead. Unfortunately, the internal design of GM does not allow storing empty profiles.
It would be very helpful if the problematic PNG was attached to this bug report, bundled up as a zip archive in order to prevent SourceForge from modifying it.
The attachment is 3 problematic PNG images. These PNG have a 0 length profile. So, in 1150, GM throw a CoderError exception. All these images look right in browser or a system photo viewer. That's why I suggest that GM could just ignore this profile with 0 length.
I've pushed a fix to coders/png.c for Bob's review. GM will issue a warning about the profile and will then proceed to convert the image without copying the bad profile. The other profiles in the image are preserved.
Last edit: Glenn Randers-Pehrson 2015-11-04
Thanks for your adoption of my suggestion. I have some other questions about GM, which I will open new tickets.
I am satisfied with Glenn's fix. All seems good. Valgrind is happy.