|  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
 [2004-05-12 17:27 UTC] adrian at psoft dot biz
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:

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


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

Actual result:
#0  0xb719ecd9 in _int_free () from /lib/tls/
#1  0xb719dc88 in free () from /lib/tls/
#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/
#6  0xb6e0e788 in execute () from /etc/httpd/modules/
#7  0xb6dffe76 in zend_execute_scripts () from /etc/httpd/modules/
#8  0xb6dd46b4 in php_execute_script () from /etc/httpd/modules/


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-05-12 18:52 UTC]
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 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-2022 The PHP Group
All rights reserved.
Last updated: Thu Aug 11 14:05:44 2022 UTC