php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #57240 php / apache2 segfault
Submitted: 2006-09-14 18:43 UTC Modified: 2013-02-18 00:35 UTC
From: mark at everytruckjob dot com Assigned:
Status: No Feedback Package: Fileinfo (PECL)
PHP Version: 5.1.6 OS: slackware 10.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.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mark at everytruckjob dot com
New email:
PHP Version: OS:

 

 [2006-09-14 18:43 UTC] mark at everytruckjob dot com
Description:
------------
Fileinfo package causes segfaults when run under apache 2.2.3 / php5.1.6 or from cli.

Reproduce code:
---------------
<?php
$finfo = new finfo(FILEINFO_MIME);
echo $finfo->buffer('test') ."\n";
?>


Under apache/php but not cli the following also causes a segfault:
<?php
$finfo = finfo_open(FILEINFO_MIME);
echo finfo_buffer($finfo, "hello world") ."\n";
finfo_close($finfo);
?>


Expected result:
----------------
text/plain; charset=us-ascii

Actual result:
--------------
Causes a segfault.  I tried getting a backtrace by compiling with --enable-debug, but I never got a core dump.  Using "gdb httpd" and then "run -X" all I get is the following:

Program received signal SIGSEGV, Segmentation fault. 
0xb7dc0048 in ?? () 
gdb) bt 
#0  0xb7dc0048 in ?? () 
#1  0x00000061 in ?? () 
#2  0x00000061 in ?? () 
#3  0xbf8d7130 in ?? () 
#4  0xbf8d9158 in ?? () 
#5  0xb70ab2f2 in ?? () 
#6  0x776f6e6b in ?? () 
#7  0x00000000 in ?? ()
(gdb)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-10-11 20:06 UTC] ilia at prohost dot org
By the lack of backtrace information and given that PHP was 
compiled with enable debug it sounds like the fileinfo library 
is crashing. What version of the lib are you using and have 
your considered upgrading it?
 [2006-10-16 18:03 UTC] mark at everytruckjob dot com
I've tried both the pecl version 1.0.3 and the cvs version (fileinfo.c v1.15) of fileinfo.

Is this the version info of the lib or is there a system lib that the php fileinfo library links to?
 [2006-11-07 16:34 UTC] ilia at prohost dot org
Can you compile your php with debug symbols so that the 
backtrace is a bit more informative? From the little I see now 
it is entirely possible the bug is in the fileinfo library 
itself. So the first step would be to try and upgrade the lib.
 [2006-11-08 09:35 UTC] mark at everytruckjob dot com
It turns out that slackware's version of file-4.17 (and hence libmagic) included in its "bin" package is compiled with "--enable-shared=no".  Recompiling with shared libs enabled fixed the problem so far.

Does fileinfo depend on the libmagic shared library?  If so, perhaps a better configure test could be written to detect if it exists?  The only way I was able to find this out was to do an ldd on php's fileinfo.so shared library.

I've left the status of this report as open in case it's felt this should be changed to a feature/change request... if not, then close it at your discretion. 

Thanks for helping me figure out the problem.
 [2006-11-09 20:23 UTC] ilia at prohost dot org
Does fileinfo depend on the libmagic shared library?
Yes, absolutely, the core functionality is provided by this 
library.

The configure script checks all the common lib paths + the one 
you can specify yourself for the presence of the library using 
standard PHP autoconf marcos.
 [2013-02-18 00:35 UTC] pecl-dev at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 02:01:30 2024 UTC