php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10890 Segmentation fault when using mcrypt function in Apache
Submitted: 2001-05-15 17:48 UTC Modified: 2001-05-20 17:50 UTC
From: henrik_l at mailme dot dk Assigned: derick (profile)
Status: Closed Package: mcrypt related
PHP Version: 4.0.5 OS: FreeBSD 4.1.1
Private report: No CVE-ID: None
 [2001-05-15 17:48 UTC] henrik_l at mailme dot dk
If i try to run this script:
<?php
$key = "this is a very secret key";
$input = "Let us meet at 9 o'clock at the secret place.";

$td = mcrypt_module_open (MCRYPT_TripleDES, "", MCRYPT_MODE_ECB, "");
$iv = mcrypt_create_iv (mcrypt_enc_get_iv_size ($td), MCRYPT_RAND);
mcrypt_generic_init ($td, $key, $iv);
$encrypted_data = mcrypt_generic ($td, $input);
mcrypt_generic_end ($td);

echo $encrypted_data;
?>

I get this in my Apache log file:
[Tue May 15 23:30:13 2001] [notice] child pid 22372 exit signal Segmentation fault (11)
[Tue May 15 23:30:13 2001] [notice] child pid 22371 exit signal Segmentation fault (11)

I did configure libmcrypt 2.4.9 with:
./configure --disable-posix-threads

And PHP 4.0.5 with:
./configure --with-mysql=/usr/local/mysql --with-gd=/usr/local --with-t1lib --with-ttf --with-jpeg-dir --with-png-dir --with-tiff-dir --with-zlib-dir --with-xpm-dir --with-imap --with-gettext --with-zlib --with-pdflib --enable-exif --enable-ftp --enable-bcmath --with-mcrypt --with-config-file-path=/usr/local/etc --with-apxs=/usr/local/apache/bin/apxs

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-05-17 16:48 UTC] henrik_l at mailme dot dk
I tried today with libmcrypt-2.4.11 both with --disable-posix-threads and without.

In both cases i get the segmentation fault in the apache log.
 [2001-05-17 17:02 UTC] derick@php.net
Hello,

I'm on this, probably found the bug already. I'll commit the fix as soon as I tested it and my connection works 100%.

Derick
 [2001-05-17 17:43 UTC] derick@php.net
This should be fixed in CVS. Can you please try a snapshot in about two hours? (The snapshots have to be generated, and are available on snaps.php.net)
If this does not fix the problem for you, please reopen this report.
 [2001-05-18 03:58 UTC] henrik_l at mailme dot dk
I downloaded and compiled this one:
php4-200105172345

But im still getting this in my Apache error log when i try to use Mcrypt:
[Fri May 18 09:56:24 2001] [notice] child pid 50599 exit signal Segmentation fault (11)
[Fri May 18 09:56:25 2001] [notice] child pid 50595 exit signal Segmentation fault (11)
 [2001-05-18 06:20 UTC] derick@php.net
Can you make a backtrace of it, and possible try it with libmcrypt 2.4.11 (or .12 if it's out yet)?

Derick
 [2001-05-18 08:39 UTC] henrik_l at mailme dot dk
This is a backtrack with:
apache-1.3.19
php4-200105172345
libmcrypt-2.4.11


#0  permute (
    inblock=0x827dda4 "Let us meet at 9 o'clock at the secret place.", 
    perm=0x1980, outblock=0xbfbfe2a8 "") at tripledes.c:628
#1  0x2859de9d in tripledes_LTX__mcrypt_encrypt () at tripledes.c:454
#2  0x285a1711 in ecb_LTX__mcrypt () at ecb.c:76
#3  0x2851b8ba in mcrypt_enc_get_algorithms_name () at mcrypt_modules.c:178
#4  0x2851ae09 in mcrypt_generic () at mcrypt.c:136
#5  0x282d1cc8 in php_if_mcrypt_generic () at mcrypt.c:391
#6  0x28264dd7 in execute () at ./zend_execute.c:863
#7  0x282762b0 in zend_execute_scripts () at zend.c:260
#8  0x2828e60b in php_execute_script () at main.c:1138
#9  0x28289ba6 in apache_php_module_main () at sapi_apache.c:98
#10 0x2828a8f4 in send_php (r=0x8279034, display_source_mode=0, 
    filename=0x8279b3c "/usr/home/hoise/www/www.larsson.as/php/test/mcrypt.php") at mod_php4.c:536
#11 0x2828a93b in send_parsed_php (r=0x8279034) at mod_php4.c:547
#12 0x28073809 in ap_invoke_handler ()
   from /usr/local/apache/libexec/libhttpd.so
#13 0x2808adc0 in process_request_internal ()
   from /usr/local/apache/libexec/libhttpd.so
#14 0x2808ae39 in ap_process_request ()
   from /usr/local/apache/libexec/libhttpd.so
#15 0x28080b90 in child_main () from /usr/local/apache/libexec/libhttpd.so
#16 0x28080e58 in make_child () from /usr/local/apache/libexec/libhttpd.so
#17 0x28080f2b in startup_children ()
   from /usr/local/apache/libexec/libhttpd.so
#18 0x2808166a in standalone_main () from /usr/local/apache/libexec/libhttpd.so
#19 0x2808208b in ap_main () from /usr/local/apache/libexec/libhttpd.so
#20 0x80485cb in main ()
#21 0x8048541 in _start ()

Please let me know if this is what you needed.
Or tell me what else to give you.

Im not that experienced in debuggin, so please give me clear instructions :-)
 [2001-05-18 16:58 UTC] derick@php.net
Hello,

I fixed this in the CVS, can you please try it with libmcrypt 2.4.11 (as .10 returns wrong data).

Derick
 [2001-05-20 17:50 UTC] henrik_l at mailme dot dk
Sure works now.

If the key length was the problem all way trough, maby you should consider changeing the example in the PHP manual :-)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 12:01:27 2024 UTC