php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59594 imagick crashes webserver when opening image files
Submitted: 2011-01-28 05:42 UTC Modified: 2013-12-03 11:34 UTC
Votes:8
Avg. Score:4.6 ± 0.7
Reproduced:5 of 6 (83.3%)
Same Version:4 (80.0%)
Same OS:2 (40.0%)
From: tomkrawc at gmail dot com Assigned: mkoppanen
Status: Assigned Package: imagick (PECL)
PHP Version: 5.3.1 OS: Windows 2003 and 7
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-01-28 05:42 UTC] tomkrawc at gmail dot com
Description:
------------
On Windows with PHP 5.3 Imagick 3.0.1 crashes webserver. It happens when I execute: readImage() or constructor with file name in string.

I checked it on IIS 6 with PHP 5.3.2 VC9, NTS and on Windows 7 x64 with 32 bit WampServer (PHP 5.3.1 VC6 TS).


As discoused here http://news.php.net/php.pecl.dev/7949 examples from source code captcha.php and polygon work fine but thumbnail.php and watermark.php are crashing webservers.

Reproduce code:
---------------
$im = new Imagick();
$im->readImage(); // crash

or

$im = new Imagick('cat.jpg'); // crash



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-28 05:45 UTC] tomkrawc at gmail dot com
a small mistake in Reproduce code

$im = new Imagick();
$im->readImage('cat.jpg'); // crash
 [2011-01-28 06:13 UTC] mkoppanen@php.net
Are you using ImageMagick binaries from www.imagemagick.org or compiling your own?
 [2011-01-28 06:48 UTC] tomkrawc at gmail dot com
I use binaries from ImageMagick www.imagemagick.org (6.6.7, Q8, dynamic). Imagic was compiled by me with headers and libraries from instalation program of ImageMagick.
 [2011-01-28 07:37 UTC] mkoppanen@php.net
Have you installed Visual C++ 2010 Redistributable Package?
 [2011-01-28 08:52 UTC] tomkrawc at gmail dot com
I installed it on the machine with IIS6, then restarted. Still captcha.php and polygon.php wotk but watermark.php and thumbnail.php not.
 [2011-02-01 01:36 UTC] tomkrawc at gmail dot com
Yesterday I installed PHP 5.2.11 on my WampServer. I have  the same problems on it.
 [2011-02-27 05:31 UTC] shlomi at shlomi dot info

 [2011-05-06 06:33 UTC] mkoppanen@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PECL.


Is this still an issue?
 [2011-05-12 06:34 UTC] tomkrawc at gmail dot com
I installed ImageMagick 6.6.9-8 Q8 and compiled imagick 3.1.0b1. Now watermark.php and thumbnail.php work fine on my IIS 6.0!

The bug is fixed and may be closed.

Thanks!!!
 [2011-05-16 17:13 UTC] tk1 at dev dot freshsite dot pl
I installed imagick 3.1.0 b1 on my wamp

imagick module version 	3.1.0b1
imagick classes 	Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator
ImageMagick version 	ImageMagick 6.6.9-9 2011-05-10 Q8 http://www.imagemagick.org
ImageMagick copyright 	Copyright (C) 1999-2011 ImageMagick Studio LLC
ImageMagick release date 	2011-05-10
ImageMagick number of supported formats: 	215 

This version doesn't crash the web server but displays such error: 

Fatal error: Uncaught exception 'ImagickException' with message 'unable to open image `adriana.jpg': No such file or directory @ error/blob.c/OpenBlob/2587' in D:\wamp\www\imagick\thumbnail.php:11 Stack trace: #0 D:\wamp\www\imagick\thumbnail.php(11): Imagick->readimage('adriana.jpg') #1 {main} thrown in D:\wamp\www\imagick\thumbnail.php on line 11

Fatal error: Uncaught exception 'ImagickException' with message 'unable to open image `adriana.jpg': No such file or directory @ error/blob.c/OpenBlob/2587' in D:\wamp\www\imagick\watermark.php:15 Stack trace: #0 D:\wamp\www\imagick\watermark.php(15): Imagick->readimage('adriana.jpg') #1 {main} thrown in D:\wamp\www\imagick\watermark.php on line 15

The source file exists in D:\wamp\www\imagick\ directory and web server has rights to read and write in this directory. 
I have installed Visual C++ 2010 Redistributable Package.
 [2011-07-28 02:51 UTC] tomkrawc at gmail dot com
The bug may be closed. I shecked it with latest beta version. The only thing for Windows I had to do was change in example scripts to use absolute paths. This is the patch for thumbnail.php.

--- thumbnail_org.php	2011-02-19 16:23:44.000000000 +0100
+++ thumbnail.php	2011-07-27 15:08:21.339302100 +0200
@@ -7,14 +7,17 @@
 /* Create the Imagick object */
 $im = new Imagick();
  
+/* get images directory */
+$sDir = pathinfo( realpath('cat.jpg'), PATHINFO_DIRNAME) . '\\';
+
 /* Read the image file */
-$im->readImage( '/tmp/test.png' );
+$im->readImage( $sDir . 'cat.jpg');
  
 /* Thumbnail the image ( width 100, preserve dimensions ) */
 $im->thumbnailImage( 100, null );
  
 /* Write the thumbail to disk */
-$im->writeImage( '/tmp/th_test.png' );
+$im->writeImage( $sDir . 'th_cat.jpg' );
  
 /* Free resources associated to the Imagick object */
 $im->destroy(); 

So, the bug may be closed.
 [2011-09-04 03:01 UTC] tk1 at dev dot freshsite dot pl
I confirm. When using full paths then all works fine in version 3.1.0b1.
The bug may be closed.
 [2012-02-13 16:11 UTC] ilia dot stolov at gmail dot com
The problem happens to me too on the following code:
$im = new Imagick();
$im->readImage(); // crash w/o exception error

The image file:
theappsearcher.com/images/apps2/489379948/mzl.qqkhqalu.png
 [2013-12-03 11:34 UTC] mike@php.net
-Assigned To: +Assigned To: mkoppanen
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sun Apr 20 05:03:19 2014 UTC