php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28971 imagecreatefromstring causes Apache2 Segfault
Submitted: 2004-06-30 10:42 UTC Modified: 2004-07-12 01:00 UTC
From: russell dot seymour at turtlesystems dot co dot uk Assigned:
Status: No Feedback Package: Reproducible crash
PHP Version: 4.3.6 OS: Gentoo Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2004-06-30 10:42 UTC] 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 ?? ()


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-04 18:49 UTC] iliaa@php.net
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. 
 [2004-07-12 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 12 15:01:30 2024 UTC