php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54404 Imagick::cropImage segfault
Submitted: 2011-03-27 23:31 UTC Modified: 2012-02-14 21:26 UTC
From: davidjmemmett at gmail dot com Assigned:
Status: Not a bug Package: imagick (PECL)
PHP Version: 5.3.6 OS: Ubuntu 10.10
Private report: No CVE-ID: None
 [2011-03-27 23:31 UTC] davidjmemmett at gmail dot com
Description:
------------
Calls to Imagick::cropImage fail. I've tried the OS-shipped imagick.so and I've 
also installed it via pecl (after uninstalling the OS-shipped one).

Test script:
---------------
<?php

$image = new Imagick('mario-1-1.gif');
$image->cropImage(8,8,0,0);

Expected result:
----------------
I expect no segmentation fault.

Actual result:
--------------
david@icecap:~/mario-images$ gdb php
GNU gdb (GDB) 7.2-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/php...Reading symbols from 
/usr/lib/debug/usr/bin/php5...done.
done.
(gdb) run test.php 
Starting program: /usr/bin/php test.php
[Thread debugging using libthread_db enabled]
[New Thread 0xb7d6eb70 (LWP 3597)]
[Thread 0xb7d6eb70 (LWP 3597) exited]
[New Thread 0xb7d6eb70 (LWP 3598)]
[New Thread 0xb6e32b70 (LWP 3599)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb6e32b70 (LWP 3599)]
0x0144e8da in ?? ()
(gdb)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-03-27 23:33 UTC] pajoye@php.net
-Status: Open +Status: Bogus
 [2011-03-27 23:33 UTC] pajoye@php.net
Please report imagick bugs at pecl.php.net
 [2011-03-28 00:01 UTC] davidjmemmett at gmail dot com
I've just run this again, and gotten a different error. Code is the same.

(gdb) run test.php 
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /usr/bin/php test.php
[Thread debugging using libthread_db enabled]
[New Thread 0xb7d6eb70 (LWP 4252)]
[Thread 0xb7d6eb70 (LWP 4252) exited]
[New Thread 0xb7d6eb70 (LWP 4253)]
[New Thread 0xb6e32b70 (LWP 4254)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb6e32b70 (LWP 4254)]
0x0144e8dd in do_wait (bar=0x89f15f0, state=4)
    at ../../../src/libgomp/config/linux/wait.h:53
53	../../../src/libgomp/config/linux/wait.h: No such file or directory.
	in ../../../src/libgomp/config/linux/wait.h
 [2012-02-14 20:37 UTC] spam at spam dot com
I confirm, I have this error too in the latest PHP 5.3.3-7+squeeze3 with Suhosin-
Patch (cli) (built: Jun 28 2011 08:24:40)
 [2012-02-14 21:11 UTC] spam at spam dot com
This problem can be cured by setting the number of used threads to 1:

$img->setResourceLimit(6, 1); // 6 means THREAD_LIMIT (unfortunately, there is no 
such constant defined, so u have to use this integer value);
 [2012-02-14 21:26 UTC] davidjmemmett at gmail dot com
-Package: Reproducible crash +Package: imagick
 [2012-02-14 21:26 UTC] davidjmemmett at gmail dot com
I do not think that this is an acceptable workaround. Not only do I feel it's 
very strange that setting an environment variable 'might' stop PHP from 
segfaulting: PHP should not be caused to segfault through the standard use of a 
library.
 [2012-02-14 21:26 UTC] davidjmemmett at gmail dot com
Could somebody please re-open this?
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Aug 14 20:01:24 2020 UTC