php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66732 Imagick causes PHP to crash
Submitted: 2014-02-18 10:25 UTC Modified: 2014-02-18 10:55 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: f21 dot groups at gmail dot com Assigned:
Status: Closed Package: imagick (PECL)
PHP Version: 5.5.9 OS: Ubuntu 13.10 64-bit
Private report: No CVE-ID: None
 [2014-02-18 10:25 UTC] f21 dot groups at gmail dot com
Description:
------------
I am running PHP-FPM 5.5.9 with Nginx 1.4.4.
Operating system is Ubuntu 13.10 64-bit.
ImageMagick is ImageMagick 6.8.8-7 Q8 x86_64 2014-02-18 which was just built from source.
Imagick is 3.2.0 RC1.

All PHP extensions have been disabled.

I am seeing a case where under some circumstances if we call identifyImage() the extension causes PHP to crash.

The code is a heavily simplified version of one of my original classes.

Test script:
---------------
class Image{

	private $_imagick;

	public function __construct($input){

		if($input instanceof  \Imagick){
			$this->_imagick = $input;
		}else{
			$this->_imagick = new \Imagick($input);
		}
	}

	public function createIcon(){

		$icon = new \Imagick();

		$newSize = clone $this;
		$newSize->resize();
		$icon->addImage($newSize->getImagickObject());
		$icon->identifyimage(); //Causes the crash

	}

	public function resize(){

		$canvas = new \Imagick();
		$canvas->newImage(16, 16, "white");
		
		$this->_imagick = $canvas;
	}

	public function getImagickObject(){
		return $this->_imagick;
	}

	public function __clone(){
		$this->_imagick = clone $this->_imagick;
	}
}

$img = new Image('bg.jpg');
$img->createIcon();

Expected result:
----------------
PHP should not crash.

Actual result:
--------------
PHP crashes.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-02-18 10:36 UTC] f21 dot groups at gmail dot com
Before trying the latest ImageMagick, I was using a copy built in early December last year and the crash also happens.
 [2014-02-18 10:54 UTC] f21 dot groups at gmail dot com
Closing this in favour of issue on Github:
https://github.com/mkoppanen/imagick/issues/23
 [2014-02-18 10:55 UTC] f21 dot groups at gmail dot com
-Status: Open +Status: Closed
 [2014-02-18 10:55 UTC] f21 dot groups at gmail dot com
Trying to close again.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 23:01:30 2024 UTC