#28971 [Opn->Fbk]: imagecreatefromstring causes Apache2 Segfault
| From: | iliaa@php.net | Date: | Sun, 04 Jul 2004 16:49:58 +0000 |
| Subject: | #28971 [Opn->Fbk]: imagecreatefromstring causes Apache2 Segfault | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-61665@lists.php.net to get a copy of this message | ||
ID: 28971
Updated by: iliaa@php.net
Reported By: russell dot seymour at turtlesystems dot co dot uk
-Status: Open
+Status: Feedback
Bug Type: Reproducible crash
Operating System: Gentoo Linux
PHP Version: 4.3.6
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
When compiling PHP make sure to built it with
--enable-debug so that a detailed backtrace can be
generated.
Previous Comments:
------------------------------------------------------------------------
[2004-06-30 10:42:41] russell dot seymour at turtlesystems dot co dot
uk
Description:
------------
I have some photos in a MySQL database stored as BLOBS.
I have some php code that pulls these blobs from the database and
creates thumbnails on the fly.
I am using imagecreatefromstring to do this.
The strange thing is that I have 7 images and the third one works -
none of the others do. However if I move the code and the database to
another Apache/PHP system (this time using Solaris 9) everything works
without modification.
I have tried the fix in "Bug #24174: Seg. fault when calling
imagecreatefromstring" but this has not worked.
My PHP configure line is:
./configure' '--prefix=/usr' '--host=i586-pc-linux-gnu'
'--mandir=/usr/share/man' '--infodir=/usr/share/info'
'--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib'
'--with-apxs2=/usr/sbin/apxs2' '--with-ndbm=/usr' '--with-db4=/usr'
'--with-mcrypt=/usr' '--with-mhash=/usr' '--without-interbase'
'--without-ming' '--without-swf' '--without-sybase'
'--with-gdbm=/usr'
'--without-fdftk' '--with-java=/opt/blackdown-jdk-1.4.1'
'--without-mcal' '--without-unixODBC' '--without-pgsql'
'--without-snmp' '--with-xpm-dir=/usr/X11R6' '--without-gmp'
'--without-mssql' '--without-pdflib' '--with-gd=/usr'
'--enable-gd-native-ttf' '--with-png=/usr' '--with-png-dir=/usr'
'--with-jpeg=/usr' '--with-jpeg-dir=/usr' '--enable-exif'
'--without-tiff' '--with-mysql=/usr'
'--with-mysql-sock=/var/run/mysqld/mysqld.sock'
'--with-freetype-dir=/usr' '--with-ttf=/usr' '--with-t1lib=/usr'
'--with-gettext' '--with-qtdom=/usr/qt/3' '--with-pspell=/usr'
'--with-openssl=/usr' '--with-imap=/usr' '--with-ldap=/usr'
'--with-dom=/usr' '--with-dom-xslt=/usr' '--with-dom-exslt=/usr'
'--with-kerberos=/usr' '--with-pam' '--disable-memory-limit'
'--disable-ipv6' '--without-yaz' '--without-curl'
'--enable-dbx'
'--with-imap-ssl' '--with-zlib=/usr' '--with-zlib-dir=/usr'
'--with-sablot=/usr' '--enable-xslt' '--with-xslt-sablot'
'--with-xmlrpc' '--enable-wddx' '--with-xml'
'--enable-mbstring=all'
'--enable-mbregex' '--with-bz2=/usr' '--with-crack=/usr'
'--with-cdb'
'--enable-pcntl' '--enable-bcmath' '--enable-calendar'
'--enable-dbase'
'--enable-filepro' '--enable-ftp'
'--with-mime-magic=/usr/share/misc/file/magic.mime' '--enable-sockets'
'--enable-sysvsem' '--enable-sysvshm' '--enable-sysvipc'
'--with-iconv'
'--enable-shmop' '--enable-dio' '--enable-yp'
'--without-ncurses'
'--without-readline' '--enable-inline-optimization'
'--enable-track-vars' '--enable-trans-sid' '--enable-versioning'
'--with-config-file-path=/etc/php/apache2-php4'
Reproduce code:
---------------
// build up sql to get data from database
$s_SQL = "SELECT file_type, image, category FROM t_images WHERE id =
${i_Img_ID}";
// Execute the query on the database
$o_Img = $o_DB -> query ($s_SQL);
if (DB::isError($o_Img)) {
print $o_Img -> getMessage();
exit;
}
// proceed if no errors
if ($o_Img) {
$a_Size = array();
// get information from the query
list ($type_Tmp, $bin_Tmp, $i_Cat_ID) = $o_Img -> fetchrow();
$a_Size["bin"] = imagecreatefromstring ($bin_Tmp);
$a_Size["file_type"] = $type_Tmp;
}
Expected result:
----------------
The above (cut code) should result in 7 images having been resampled
with a height of 135px and a width dependant on the orginal aspect
ratio.
Actual result:
--------------
Program received signal SIGSEGV, Segmentation fault.
0x403ce9b7 in pthread_mutex_lock () from /lib/libpthread.so.0
(gdb) bt
#0 0x403ce9b7 in pthread_mutex_lock () from /lib/libpthread.so.0
#1 0x404772e3 in free () from /lib/libc.so.6
#2 0x4136f1f8 in ?? ()
#3 0x08403a44 in ?? ()
#4 0x083eb65c in ?? ()
#5 0x083eb5ac in ?? ()
#6 0x4136f1e6 in ?? ()
#7 0x0840d25c in ?? ()
#8 0x0840d18c in ?? ()
#9 0x41391854 in ?? ()
#10 0x41363619 in ?? ()
#11 0x08403a44 in ?? ()
#12 0x08403a44 in ?? ()
#13 0x00000001 in ?? ()
#14 0x413635d2 in ?? ()
#15 0x083eb500 in ?? ()
#16 0x083eb528 in ?? ()
#17 0x40ae772c in ?? ()
#18 0x406eaaaa in ?? ()
#19 0x083eb500 in ?? ()
#20 0x08403a44 in ?? ()
#21 0xbfffb390 in ?? ()
#22 0x406eaa26 in ?? ()
#23 0xbfffb358 in ?? ()
#24 0x40a5266f in ?? ()
#25 0x00000003 in ?? ()
#26 0x406ea8b5 in ?? ()
#27 0x083eb500 in ?? ()
#28 0x0840fa58 in ?? ()
#29 0x40ae772c in ?? ()
#30 0x406eabfc in ?? ()
#31 0x08347f60 in ?? ()
#32 0x40901902 in ?? ()
#33 0x4136478e in ?? ()
#34 0x406eaac8 in ?? ()
#35 0x083eab14 in ?? ()
#36 0xbfffb72c in ?? ()
#37 0xe0ffd8ff in ?? ()
#38 0x464a1000 in ?? ()
#39 0x083eab14 in ?? ()
#40 0x00000003 in ?? ()
#41 0x00000010 in ?? ()
#42 0x08347f60 in ?? ()
#43 0x40ae772c in ?? ()
#44 0x40ae772c in ?? ()
#45 0xbfffb390 in ?? ()
#46 0x408763da in ?? ()
#47 0x00000001 in ?? ()
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28971&edit=1