php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13775 Segfault (11) with PHP 4.0.6 / Apache 1.3.22
Submitted: 2001-10-21 06:38 UTC Modified: 2001-10-24 05:39 UTC
From: brian at spamcop dot net Assigned:
Status: Not a bug Package: GD related
PHP Version: 4.0.6 and 4.2.0-dev OS: Linux - SuSE 7.2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: brian at spamcop dot net
New email:
PHP Version: OS:

 

 [2001-10-21 06:38 UTC] brian at spamcop dot net
With this code (via Rasmus/php-general):

<http://www.php.net/~rasmus/reductor.php>

<html>
<body bgcolor="#000000">
<font color=#ffffff>Original Image:</font><img src="php.png" align=middle><br clear=left>
<?php
 if(!$ch) $ch='$';
 $im = ImageCreateFromPNG('./php.png');
 $output = " ";
 for($y=0;$y<imagesy($im);$y++) {
  for($x=0;$x<imagesx($im);$x++) {
   $color = ImageColorsForIndex($im,ImageColorAt($im, $x, $y));
   echo "<font size=\"1\" color=\"#";
   echo printf("%02x%02x%02x",$color['red'],$color['green'],$color['blue']);
   echo "\">$ch</font>";
  }
  echo "<br>\n";
 }
?>
</body></html>

Apache stops responding; Nothing is displayed, not even an error. Apache must be restarted to bring it back to life. 

In the error_log, one sees:

[Sun Oct 21 06:10:03 2001] [notice] child pid 28635 exit signal Segmentation fault (11)
[Sun Oct 21 06:10:03 2001] [notice] child pid 28634 exit signal Segmentation fault (11)
Etc...



My php 4.0.6 configure line:

./configure \
--with-config-file-path=/var/www/conf \
--with-gd=/usr/local \
--with-jpeg-dir=/usr/local \
--with-png-dir=/usr/local/ \
--with-tiff-dir=/usr/local \
--with-zlib-dir=/usr \
--with-zlib=/usr \
--with-ttf=/usr/local \
--with-t1lib=/usr/local \
--with-mysql=/usr \
--with-mcrypt=/usr/local \
--with-pdflib=/usr/local \
--with-bz2=/usr/local \
--with-zip=/usr/local \
--with-pspell=/usr/local \
--with-curl=/usr/local \
--with-dom=/usr \
--with-xml \
--enable-magic-quotes \
--enable-ftp \
--with-apache=../apache_1.3.22 > ~root/php_configure.log


My Apache 1.3.22 configure line:

./configure \
--prefix=/var/www \
--mandir=/usr/local/man \
--server-uid=www \
--server-gid=www \
--libexecdir=/var/www/modules \
--enable-module=rewrite \
--enable-module=so \
--enable-shared=speling \
--enable-module=ssl \
--activate-module=src/modules/php4/libphp4.a \
--activate-module=src/modules/perl/libperl.a

I listed this as graphics related, but I really don't know if it really is.

-Brian

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-21 06:58 UTC] brian at spamcop dot net
By the way, as far as verified gd/png support in my build:

% egrep -i '(png|gd)' ~root/php_configure.log 
checking for GDBM support... no
checking whether to include GD support... yes
checking whether to enable truetype string function in gd... no
checking for the location of libpng... yes
checking for png_info_init in -lpng... yes
checking for gdImageString16 in -lgd... yes
checking for gdImagePaletteCopy in -lgd... yes
checking for gdImageCreateFromPng in -lgd... yes
checking for gdImageCreateFromGif in -lgd... no
checking for gdImageWBMP in -lgd... yes
checking for gdImageCreateFromJpeg in -lgd... yes
checking for gdImageCreateFromXpm in -lgd... yes
checking for gdImageCreateTrueColor in -lgd... no
checking for gdImageSetTile in -lgd... yes
checking for gdImageSetBrush in -lgd... yes
checking for gdImageStringFTEx in -lgd... no
checking for gdImageColorClosestHWB in -lgd... yes
checking for gdImageColorResolve in -lgd... yes
checking for gdImageGifCtx in -lgd... no
checking for the location of libpng... yes
checking for png_create_info_struct in -lpng... yes
creating ext/gd/Makefile

 [2001-10-21 18:28 UTC] sniper@php.net
I can't reproduce this with PHP 4.1.0Rc1 and GD 1.8.4.
Which GD version do you have?

 [2001-10-21 19:11 UTC] brian at spamcop dot net
Same version.

% ls /usr/local/src/graphics    
T1Lib-1.2  freetype-2.0.4  gd-1.8.4  jpeg-6b  libpng-1.2.0


I'm still testing; I was tired as $#!t last night and I had to give it up.  So I guess this may be directly related to graphics after all?

For the record, I also tested without mod_ssl and without mod_perl as well. Still segfaulted.

I'm about to try 4.0.8-dev from snaps and see if that makes any difference.

 


 [2001-10-21 19:56 UTC] brian at spamcop dot net
No such luck.

% uname -a
Linux callisto 2.4.12-4GB #1 Fri Oct 19 08:34:54 GMT 2001 i686 unknown

Still SuSE 7.2..

PHP 4.2.0-dev:

% ./configure \
--with-config-file-path=/var/www/conf \
--with-gd=/usr/local \
--with-tiff-dir=../tiff-v3.5.6-beta \
--with-jpeg-dir=/usr/local \
--with-png-dir=/usr/local/ \
--with-zlib-dir=/usr \
--with-zlib=/usr \
--with-t1lib=/usr/local \
--with-mysql=/usr \
--with-mcrypt=/usr/local \
--with-pdflib=/usr/local \
--with-bz2=/usr/local \
--with-zip=/usr/local \
--with-pspell=/usr/local \
--with-curl=/usr/local \
--with-xml \
--enable-magic-quotes \
--enable-ftp \
--enable-gd-native-tt \
--enable-gd-imgstrttf \
--with-freetype-dir=/usr/local/include/freetype2 \
--with-apache=../apache_1.3.22 > ~root/php_configure.log


I excluded DOM this time because of failed deps in 4.2.0-dev with libxml

% cd ../apache_1.3.22

% SSL_BASE=/usr/include/openssl
% ./configure \
--prefix=/var/www \
--mandir=/usr/local/man \
--server-uid=www \
--server-gid=www \
--libexecdir=/var/www/modules \
--enable-module=rewrite \
--enable-module=so \
--enable-shared=speling \
--enable-module=ssl \
--activate-module=src/modules/php4/libphp4.a \
--activate-module=src/modules/perl/libperl.a

% cp src/httpd /var/www/bin/httpd

Started https (SSL) and accessed the same script and got the segfault 11 again.

Suggestions? I swear gd is the devil.


 [2001-10-21 20:26 UTC] brian at spamcop dot net
And finally, a backtrace having enabled debugging:

% gdb --quiet /var/www/bin/httpd
(gdb) run -X
Starting program: /var/www/bin/httpd -X

Program received signal SIGSEGV, Segmentation fault.
0x999 in ?? ()
(gdb) bt
#0  0x999 in ?? ()
#1  0x4016e058 in png_create_info_struct () from /usr/local/lib/libpng.so.3
#2  0x823ffbc in gdImageCreateFromPngCtx ()
#3  0x823feff in gdImageCreateFromPng ()
#4  0x80fb910 in _php_image_create_from (ht=1, return_value=0x84bab8c, this_ptr=0x0, return_value_used=1, image_type=2, 
    tn=0x82fb30b "PNG", func_p=0x823fee0 <gdImageCreateFromPng>, ioctx_func_p=0x823ff20 <gdImageCreateFromPngCtx>)
    at gd.c:1182
#5  0x80fba3c in zif_imagecreatefrompng (ht=1, return_value=0x84bab8c, this_ptr=0x0, return_value_used=1) at gd.c:1229
#6  0x81e421a in execute (op_array=0x84b6544) at ./zend_execute.c:1598
#7  0x81be8a9 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at zend.c:814
#8  0x80e4f11 in php_execute_script (primary_file=0xbffff588) at main.c:1310
#9  0x81cab8c in apache_php_module_main (r=0x83b981c, display_source_mode=0) at sapi_apache.c:90
#10 0x80e1346 in send_php ()
#11 0x80e13a6 in send_parsed_php ()
#12 0x81eed39 in ap_invoke_handler ()
#13 0x8204dcf in process_request_internal ()
#14 0x8204e42 in ap_process_request ()
#15 0x81fb926 in child_main ()
#16 0x81fbb05 in make_child ()
#17 0x81fbc86 in startup_children ()
#18 0x81fc32d in standalone_main ()
#19 0x81fcbac in main ()
#20 0x4034bc6f in __libc_start_main () from /lib/libc.so.6
(gdb) 
 [2001-10-22 01:34 UTC] sniper@php.net
The segfault seems to be happening in the png code.
I guess the 1.2.0 version might not be very stable.
Try with the previous release, 1.0.12.

I will check this out myself too.

--Jani

 [2001-10-22 21:14 UTC] brian at spamcop dot net
Rebulding gd-1.8.4 with libpng-1.0.12 then rebuilding PHP 4.2.0-dev corrected the problem. Apache no longer segfaults.

However, it *says* TTF is disabled in gd:

% egrep -i truetype ~root/php_configure.log 
checking whether to enable truetype string function in gd... no

But a call to <?php imagettftext(); ?> (with no arguments) *does* give me:

Warning: Wrong parameter count for imagettftext() in /var/www/htdocs/ttf.test.php on line 3

And phpinfo() says:

FreeType Support:  enabled 
FreeType Linkage:  with freetype 
T1Lib Support:     enabled

So is that be anything to worry about?

But I suppose that doesn't matter as far as the bug report. If it's anything to worry about, just let me know privately if you want. 

For the record, the working configure(s):

PHP 4.2.0-dev

% ./configure \
--with-config-file-path=/var/www/conf \
--enable-debug \
--with-gd=/usr/local \
--with-tiff-dir=../tiff-v3.5.6-beta \
--with-jpeg-dir=/usr/local \
--with-png-dir=/usr/local \
--with-zlib-dir=/usr \
--with-zlib=/usr \
--with-t1lib=/usr/local \
--with-mysql=/usr \
--with-mcrypt=/usr/local \
--with-pdflib=/usr/local \
--with-bz2=/usr/local \
--with-zip=/usr/local \
--with-pspell=/usr/local \
--with-curl=/usr/local \
--with-xml \
--enable-magic-quotes \
--enable-ftp \
--enable-gd-native-tt \
--enable-gd-imgstrttf \
--with-freetype-dir=/usr/local/include/freetype2 \
--with-apache=../apache_1.3.22 > ~root/php_configure.log

Apache 1.3.22:

% SSL_BASE=/usr/include/openssl
% ./configure \
--prefix=/var/www \
--mandir=/usr/local/man \
--server-uid=www \
--server-gid=www \
--libexecdir=/var/www/modules \
--enable-module=rewrite \
--enable-module=so \
--enable-module=speling \
--enable-shared=speling \
--enable-module=ssl \
--activate-module=src/modules/php4/libphp4.a \
--activate-module=src/modules/perl/libperl.a \
--add-module=../mod_gzip.c

Thank you! :) You guys are great!


 [2001-10-24 05:39 UTC] sniper@php.net
The bug clearly is in either the gd library or png library
and not in PHP -> Bogus.

Please report this to the gd/png library authors.

--Jani

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 21:01:27 2024 UTC