Crash with PNG8 output

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
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Crash with PNG8 output

Post by Drarakel »

That command gives me a crash (in the PNG module):

Code: Select all

convert rose: -define png:color-type=3 rosec.png
The same with "PNG8:rosec.png" instead of the define. Using IM v6.6.7-9 Q16, on Windows XP.
Can someone reproduce that?

Of course, that's not a very reasonable command, but a crash probably should be avoided. Older IM versions reduce the image to 256 colors, or give me a "Valid palette required for paletted images" error with such commands - but not a crash.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Crash with PNG8 output

Post by glennrp »

Yes, it crashes when it tries to copy a non-existent colormap.
Verified that SVN head has this failure. Fixed in SVN r3717 and
will be in ImageMagick-6.6.7-10.
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Re: Crash with PNG8 output

Post by Drarakel »

The crash is gone. Thanks!

But the current behaviour in IM v6.6.7-10 still puzzles me a bit. An implicit color reduction is now done if necessary - right?. But...

Code: Select all

convert -verbose rose: -define png:color-type=3 test.png
ROSE PPM 70x46 70x46+0+0 8-bit DirectClass 9.67KB 0.000u 0:00.000
rose:=>ROSE ROSE 70x46 70x46+0+0 8-bit DirectClass 9.67KB 0.000u 0:00.000
rose:=>test.png ROSE 70x46 70x46+0+0 8-bit DirectClass 0.016u 0:00.016

No error, return code 0 - but test.png is a 0 byte file.

And the PNG8 command behaves differently now:

Code: Select all

convert rose: PNG8:test.png
'Working' PNG file - but with an (almost) black image. Is it supposed to be like that?
(An older IM installation - e.g. v6.5.8-5 - produces no file with such a combination and gives an "Invalid number of colors in palette" error message instead. And, as mentioned, with the 'color-type command', one got a "valid palette required" error.)
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Crash with PNG8 output

Post by glennrp »

The Q8 works OK but the Q16 is using a palette that is shifted down
by 8 bits. I thought I had fixed that but obviously didn't. Sorry, will fix
again. Thanks for the report.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Crash with PNG8 output

Post by glennrp »

The scaling down to black should be working now, SVN r3751 (IM-6.6.8-0).
Also, the zero-length file problem is fixed now, in SVN r3763.
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Re: Crash with PNG8 output

Post by Drarakel »

With IM v6.6.8-0 Q16 (Win32), the first command now works (and the colors are reduced). Thanks!
Drarakel wrote:convert rose: PNG8:test.png
But there's still a problem with 'color-type':
Drarakel wrote:convert -verbose rose: -define png:color-type=3 test.png
ROSE PPM 70x46 70x46+0+0 8-bit DirectClass 9.67KB 0.000u 0:00.000
rose:=>ROSE ROSE 70x46 70x46+0+0 8-bit DirectClass 9.67KB 0.000u 0:00.016
rose:=>test.png ROSE 70x46 70x46+0+0 8-bit DirectClass 9.67KB 0.000u 0:00.000

The verbose messages look ok. But there's no file! And also no error message. Only in the debug messages, I see a "Cannot write PNG8 or color-type 3; colormap is NULL" line.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Crash with PNG8 output

Post by el_supremo »

Glenn: I've been trying to build the windows version of 6.6.8-0 from source this evening and the png coder fails to compile with 29 messages identical to these except for line numbers:

Code: Select all

58>..\..\coders\png.c(7574): error C2296: '>>' : illegal, left operand has type 'Quantum'
58>..\..\coders\png.c(7576): error C2296: '>>' : illegal, left operand has type 'Quantum'
58>..\..\coders\png.c(7577): error C2296: '>>' : illegal, left operand has type 'Quantum'
58>..\..\coders\png.c(7578): error C2296: '>>' : illegal, left operand has type 'Quantum'
58>..\..\coders\png.c(7579): error C2296: '>>' : illegal, left operand has type 'Quantum'
I'm using the MSVC Visual Studio 2010 C++ compiler.
How can I fix these to get them to compile?
BTW - it fails with both x32 and x64 targets.

Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Crash with PNG8 output

Post by magick »

We'll release ImageMagick 6.6.8-1 by tomorrow with a patch to fix the HDRI-png compile problem. Thanks.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Crash with PNG8 output

Post by el_supremo »

Tried 6.6.8-1 with Q16, FFTW, HDRI and OPENMP and it compiles with no complaint. Thanks.

Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Crash with PNG8 output

Post by glennrp »

Drarakel wrote:The verbose messages look ok. But there's no file! And also no error message. Only in the debug messages, I see a "Cannot write PNG8 or color-type 3; colormap is NULL" line.
The exception was being thrown into the encoder's temporary image structure (image) instead of into (IMimage). Fixed in SVN r3808 for ImageMagick-6.6.8-2.
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Re: Crash with PNG8 output

Post by Drarakel »

glennrp wrote:
Drarakel wrote:The verbose messages look ok. But there's no file! And also no error message. Only in the debug messages, I see a "Cannot write PNG8 or color-type 3; colormap is NULL" line.
The exception was being thrown into the encoder's temporary image structure (image) instead of into (IMimage). Fixed in SVN r3808 for ImageMagick-6.6.8-2.
Yes, 'works' now in IM v6.6.8-2 (with a normal error message). Thank you!
Post Reply