php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28372 Seg Fault when using mhash
Submitted: 2004-05-12 17:27 UTC Modified: 2004-05-12 18:52 UTC
From: adrian at psoft dot biz Assigned:
Status: Not a bug Package: mhash related
PHP Version: 4.3.6 OS: RHEL ES 3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
23 - 18 = ?
Subscribe to this entry?

 
 [2004-05-12 17:27 UTC] adrian at psoft dot biz
Description:
------------
Apache child seg faults when calling the mhash() function from a PHP script. 

PHP 4.3.6, 4.3.5, 4.2.2
mhash 0.8.18 and 0.9.1

If I enable debug mode to generate a backtrace it doesn't seg fault, but the script below gives 000...0000 as a result, so I generated the backgrace without debug enabled.

This works using the php binary, just seg faults when called from within apache.


Reproduce code:
---------------
<?php

$str = "test string!";
echo bin2hex(mhash(MHASH_MD5, $str));

?>


Expected result:
----------------
[root@server httpdocs]# php -q mhash.php
cff1fa7b32de5979c35874350570dd74


Actual result:
--------------
#0  0xb719ecd9 in _int_free () from /lib/tls/libc.so.6
#1  0xb719dc88 in free () from /lib/tls/libc.so.6
#2  0xb6544171 in mhash_deinit (td=0xb7262720, result=0x839d948) at mhash.c:366
#3  0xb65441d3 in mhash_end_m (td=0x839d8e8, hash_malloc=0xb719da80 <malloc>) at mhash.c:384
#4  0xb6544201 in mhash_end (td=0x839d8c0) at mhash.c:391
#5  0xb65623a8 in zif_mhash () from /usr/lib/php4/mhash.so
#6  0xb6e0e788 in execute () from /etc/httpd/modules/libphp4.so
#7  0xb6dffe76 in zend_execute_scripts () from /etc/httpd/modules/libphp4.so
#8  0xb6dd46b4 in php_execute_script () from /etc/httpd/modules/libphp4.so


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-05-12 18:52 UTC] iliaa@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

Oops, didn't see the backtrace ;). 
 
After looking @ the backtrace the problem seem to occur 
deep inside mhash and therefor looks like mhash problem. 
However I am unable to replicate the problem in both the 
debug build or regular optimized build. It is likely this 
problem is the result of compiler problem on your end or 
library confusion. 
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Feb 20 11:01:24 2020 UTC