PHP/Imagick: writeImage segfaults on certain PNG

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.

PHP/Imagick: writeImage segfaults on certain PNG

Postby Jesdisciple » 2011-03-18T16:52:14+00:00

CentOS 5.5
PHP 5.2.11

# httpd -version
Server version: Apache/2.2.14 (Unix)
Server built: Oct 27 2009 16:32:50
Cpanel::Easy::Apache v3.2.0 rev4801

`man libpng' identifies itself as:
libpng - Portable Network Graphics (PNG) Reference Library 1.2.10

From phpinfo():
imagick module version
  • 2.2.2
ImageMagick version

Original topic: viewtopic.php?f=1&t=18302&p=70081

As explained at the above link, the following script consistently segfaults if this image is saved in the same directory and named original.png. If the image data is retrieved via getImageBlob, duplicate.png is a proper copy of original.png; otherwise, it is empty. The test case is to be run via php -f test.php:
Code: Select all
<?php

$thumb = new Imagick('original.png');
$thumb->setImageFormat('png');
//echo $thumb->getImageBlob();
$thumb->writeImage('duplicate.png');

?>
Last edited by Jesdisciple on 2011-03-18T17:02:17+00:00, edited 5 times in total.
Jesdisciple
 
Posts: 10
Joined: 2011-03-11T14:26:57+00:00

Re: PHP/Imagick: writeImage segfaults on certain PNG

Postby fmw42 » 2011-03-18T16:57:24+00:00

This works perfectly fine in command line on IM 6.6.8.4 Q16 Mac OSX tiger, with libpng-1.5.1

convert zc9vfo.png original.png

PNG code has been under quite a bit of change over many releases. So perhaps you need to upgrade your IM version and perhaps even your libpng or perhaps IMagick (you don't identify your IM or Imagick version). Otherwise, I would have to say it is something about your API code and I am not an API user.
User avatar
fmw42
 
Posts: 14805
Joined: 2007-07-02T17:14:51+00:00
Location: Sunnyvale, California, USA

Re: PHP/Imagick: writeImage segfaults on certain PNG

Postby Jesdisciple » 2011-03-18T17:04:45+00:00

You caught me before I thought to grab the IM versions from phpinfo. I'll have to check whether upgrading is possible for us.
Jesdisciple
 
Posts: 10
Joined: 2011-03-11T14:26:57+00:00

Re: PHP/Imagick: writeImage segfaults on certain PNG

Postby Jesdisciple » 2011-03-21T10:38:07+00:00

We've upgraded to:
ImageMagick 6.2.8 (latest on CentOS)
imagick 3.1.0 (absolute latest)

And the issue persists. Similarly to you, I don't experience a segfault on the command-line.
Jesdisciple
 
Posts: 10
Joined: 2011-03-11T14:26:57+00:00

Re: PHP/Imagick: writeImage segfaults on certain PNG

Postby fmw42 » 2011-03-21T10:48:49+00:00

version 6.2.8 is way too old (over 400 versions old). I suspect you really need to upgrade as IM has improved drastically since 6.2.8 and many bugs have been fixed. see http://www.imagemagick.org/script/binary-releases.php for current binaries or install from source.
User avatar
fmw42
 
Posts: 14805
Joined: 2007-07-02T17:14:51+00:00
Location: Sunnyvale, California, USA

Re: PHP/Imagick: writeImage segfaults on certain PNG

Postby Jesdisciple » 2011-03-21T11:14:25+00:00

Works on Ubuntu 9.10 / imagick 3.0.1 / ImageMagick 6.5.1.
Jesdisciple
 
Posts: 10
Joined: 2011-03-11T14:26:57+00:00

Re: PHP/Imagick: writeImage segfaults on certain PNG

Postby Jesdisciple » 2011-03-21T13:27:08+00:00

Upgraded to 6.6.8 on CentOS 5.5, still broken. What configurations might I check?
Jesdisciple
 
Posts: 10
Joined: 2011-03-11T14:26:57+00:00


Return to Bugs

Who is online

Users browsing this forum: jlbrown and 7 guests