Hi, This is possibly a bug in Image Magick itself, rather than the Imagick extension. ``` <?php $imagick = new Imagick(realpath("../images/TestImage.jpg")); $imagick->setImageFormat('jpg'); $imagick->setOption('jpeg:extent', '30kb'); $crash = true; if ($crash) { header("Content-Type: image/jpg"); echo $imagick->getImageBlob(); } else { $tempFilename = tempnam('./', 'imagick'); $imagick->writeimage(realpath($tempFilename)); header("Content-Type: image/jpg"); echo file_get_contents($tempFilename); } ``` The 'crash' version of generating the image blob crashes with the error message below: ``` *** glibc detected *** /usr/local/bin/php: double free or corruption (!prev): 0x0000000002671ce0 *** ======= Backtrace: ========= /lib64/libc.so.6(+0x760e6)[0x7f285292c0e6] /lib64/libc.so.6(+0x78c13)[0x7f285292ec13] /usr/lib64/libjpeg.so.62(+0x2919a)[0x7f285613519a] /usr/lib64/libjpeg.so.62(jpeg_abort+0x15)[0x7f285611e185] /usr/local/lib/libMagickCore-6.Q16.so.1(+0x25142b)[0x7f2848a3e42b] /usr/local/lib/libMagickCore-6.Q16.so.1(+0x24f9fb)[0x7f2848a3c9fb] /usr/local/lib/libMagickCore-6.Q16.so.1(WriteImage+0x5fc)[0x7f2848883e5c] /usr/local/lib/libMagickCore-6.Q16.so.1(ImageToBlob+0x154)[0x7f28488530d4] /usr/local/lib/php/extensions/no-debug-zts-20121212/imagick.so(zim_imagick_getimageblob+0x83)[0x7f28490ab8a3] /usr/local/bin/php[0x7beaf2] /usr/local/bin/php(execute_ex+0x4b)[0x7aec0b] /usr/local/bin/php(zend_execute_scripts+0x1e7)[0x72ebb7] /usr/local/bin/php(php_execute_script+0x1fb)[0x6c3b4b] /usr/local/bin/php[0x7f1024] /usr/local/bin/php[0x7f18ad] /lib64/libc.so.6(__libc_start_main+0xfd)[0x7f28528d4cdd] /usr/local/bin/php[0x4337a9] ``` cheers Dan
Activity
mkoppanen commentedon Oct 28, 2013
After quick debug this looks like ImageMagick bug.
mkoppanen commentedon Oct 30, 2013
Reproduce code:
Have you reported this upstream?
Danack commentedon Oct 31, 2013
No, do you mind doing so? I think I've used up my quota of reporting things that aren't actually issues for the month.
cheers
Dan
mkoppanen commentedon Oct 31, 2013
http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=24366
mkoppanen commentedon Nov 4, 2013
Seems like this will be fixed in ImageMagick 6.8.7-5 Beta
Fix memory leak in Imagick::colorThresholdImage()
Fix memory leak in Imagick::colorThresholdImage()
Fix memory leak in polynomialImage()
Fix memory leak in colorMatrixImage()