php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54668 Segmentation fault after execution of php script wich uses imagick
Submitted: 2011-05-05 18:24 UTC Modified: 2011-05-05 18:27 UTC
From: luminarior at gmail dot com Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 5.3.6 OS: Gentoo Linux
Private report: No CVE-ID: None
 [2011-05-05 18:24 UTC] luminarior at gmail dot com
Description:
------------
I wrote a php script (See link below) wich uses imagick (PHP wrapper for the ImageMagick library) to draw some logos for my site. The script executes and draws images OK, but in the end it generates segfaults. I think that you have some problems in your garbage collector because this script doesn't generate segfault in the end in case you use just one cycle of "for" or just one function "draw()".

I tried to compile php and imagick in debug mode and generate you some backtrace in gdb (see below):

#CFLAGS="-ggdb3" CXXFLAGS="${CFLAGS}" LDFLAGS="-Wl,-O1 -Wl,--as-needed" FEATURES="nostrip" USE="debug" emerge -1 dev-lang/php

These are the packages that would be merged, in reverse order:

Calculating dependencies... done!
[ebuild   R   ] dev-lang/php-5.3.6  USE="apache2 berkdb bzip2 cjk cli crypt ctype debug* exif fileinfo filter ftp gd gdbm hash iconv ipv6 json ldap mysql mysqli nls phar posix readline session simplexml spell ssl threads tokenizer truetype unicode xml zlib (-adabas) -bcmath (-birdstep) -calendar -cdb -cgi -curl -curlwrappers -db2 (-dbmaker) -doc -embed (-empress) (-empress-bcs) -enchant (-esoob) -firebird -flatfile -fpm (-frontbase) -gd-external -gmp -imap -inifile -interbase -intl -iodbc -kerberos -kolab -ldap-sasl -libedit -mhash -mssql -mysqlnd -oci8 -oci8-instant-client -odbc -pcntl -pdo -pic -postgres -qdbm -recode -sapdb -sharedext -sharedmem -snmp -soap -sockets (-solid) -sqlite -sqlite3 (-sybase-ct) -sysvipc -tidy -wddx -xmlreader -xmlrpc -xmlwriter -xpm -xsl -zip" 0 kB 

# CFLAGS="-ggdb3" CXXFLAGS="${CFLAGS}" LDFLAGS="-Wl,-O1 -Wl,--as-needed" FEATURES="nostrip" USE="debug" emerge -1 dev-php5/pecl-imagick

These are the packages that would be merged, in reverse order:

Calculating dependencies... done!
[ebuild   R   ] dev-php5/pecl-imagick-3.0.1-r1  USE="-examples" PHP_TARGETS="php5-3 -php5-2" 0 kB

Total: 1 package (1 reinstall), Size of downloads: 0 kB

I have the following system:
# uname -a
Linux ddd 2.6.37-gentoo-r4 #2 SMP Fri Apr 29 20:19:52 MSD 2011 x86_64 AMD Phenom(tm) II X3 710 Processor AuthenticAMD GNU/Linux

Test script:
---------------
This is my PHP script:
http://pastebin.com/x67mn6NL

Expected result:
----------------
Without segfaults in the end.

Actual result:
--------------
# gdb /usr/bin/php
GNU gdb (Gentoo 7.2 p1) 7.2
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 "x86_64-pc-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>...
Reading symbols from /usr/bin/php...done.
(gdb) set args /var/www/myhost/htdocs/imr/update-test.php
(gdb) r
Starting program: /usr/bin/php /var/www/myhost/htdocs/imr/update-test.php
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
[New LWP 7617]
[LWP 7617 exited]
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
[Thu May  5 19:37:06 2011]  Script:  '/var/www/myhost/htdocs/imr/update-test.php'
/var/tmp/portage/dev-lang/php-5.3.6/work/sapis-build/cli/Zend/zend_vm_execute.h(475) :  Freeing 0x012F2DD8 (32 bytes), script=/var/www/myhost/htdocs/imr/update-test.php
Last leak repeated 41 times
[Thu May  5 19:37:06 2011]  Script:  '/var/www/myhost/htdocs/imr/update-test.php'
/var/tmp/portage/dev-lang/php-5.3.6/work/sapis-build/cli/Zend/zend_vm_execute.h(300) :  Freeing 0x012F46A8 (32 bytes), script=/var/www/myhost/htdocs/imr/update-test.php
Last leak repeated 41 times
=== Total 84 memory leaks detected ===
[New LWP 7626]
[New LWP 7625]

Program received signal SIGSEGV, Segmentation fault.
[Switching to LWP 7625]
0x00007ffff70f1fda in ?? ()
(gdb) bt full
#0  0x00007ffff70f1fda in ?? ()
No symbol table info available.
#1  0x00007ffff70f0906 in ?? ()
No symbol table info available.
#2  0x0000000000000000 in ?? ()
No symbol table info available.
(gdb) q
A debugging session is active.

        Inferior 1 [process 7612] will be killed.

Quit anyway? (y or n) y

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-05-05 18:27 UTC] pajoye@php.net
-Status: Open +Status: Bogus
 [2011-05-05 18:27 UTC] pajoye@php.net
Please report imagick bug at pecl.php.net/imagick.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 07:01:27 2024 UTC