php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14691 some more crash
Submitted: 2001-12-25 10:07 UTC Modified: 2001-12-25 11:36 UTC
From: sitnikov at infonet dot ee Assigned:
Status: Closed Package: mcrypt related
PHP Version: 4.1.0 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sitnikov at infonet dot ee
New email:
PHP Version: OS:

 

 [2001-12-25 10:07 UTC] sitnikov at infonet dot ee
<pre>
<?
	$secret_key = "this is a very secret key this is a very secret key this is a very secret key" ;
	$input = "Let us meet at 9 o'clock at the secret place.";

  $modes = mcrypt_list_modes ();

	foreach(mcrypt_list_algorithms() as $cipher)
	{
    $cipher_name = mcrypt_get_cipher_name($cipher);

  	echo "<b>$cipher_name ($cipher)</b>";

  	echo " (self test: ";
  	echo (mcrypt_module_self_test($cipher)) ? 'OK' : 'Error';
  	echo ")<hr>\n";

    if ($cipher_name)
    {
 			$mode_list = mcrypt_list_modes();

 			while(list(,$mode) = each($mode_list))
 			{
  			$iv_size = @mcrypt_get_iv_size ($cipher, $mode);
  			$iv = @mcrypt_create_iv ($iv_size,MCRYPT_RAND);

				$td = @mcrypt_module_open ($cipher, "", $mode, "");

				echo "mcrypt_module_open ($cipher, \"\", $mode, \"\") - ";
			  if (!$td){
			    echo "failed";
			  }else{
  		    echo "ok";
          if (@mcrypt_generic_init($td, $key, $iv) != -1)
      	  {
            $c_t = mcrypt_generic ($td, $input);
            @mcrypt_generic_init ($td, $key, $iv);
            $p_t = mdecrypt_generic ($td, $c_t);
        	}

	        echo "(mdecrypt|mcrypt)_generic)$mode): ";
  	      if (strncmp ($p_t, $input, strlen($input)) == 0)
            echo "ok";
    	    else
            echo "error";

					echo "\n";
				}
        echo "\n\n";
      }
		}
	}
?>


(gdb) run -f new.php
Starting program: /export/work/php-4.1.1/./php -f new.php
<pre>
<b>Twofish (twofish)</b> (self test: OK)<hr>
mcrypt_module_open (twofish, "", ofb, "") - ok
Program received signal SIGSEGV, Segmentation fault.
0x40017c34 in ofb_LTX__mcrypt (buf=0x0, plaintext=0x83ce5ec, len=45, blocksize=16, akey=0x0, 
    func=0x425eea30 <twofish_LTX__mcrypt_encrypt>, func2=0x425ef59c <twofish_LTX__mcrypt_decrypt>) at ofb.c:114
114                     memmove(buf->enc_s_register, buf->s_register, blocksize);
(gdb) bt
#0  0x40017c34 in ofb_LTX__mcrypt (buf=0x0, plaintext=0x83ce5ec, len=45, blocksize=16, akey=0x0, 
    func=0x425eea30 <twofish_LTX__mcrypt_encrypt>, func2=0x425ef59c <twofish_LTX__mcrypt_decrypt>) at ofb.c:114
#1  0x4023d47d in mcrypt_enc_get_algorithms_name () at mcrypt_modules.c:367
#2  0x4023c741 in mcrypt_generic (td=0x83cc2c0, plaintext=0x83ce5ec, len=45) at mcrypt.c:165
#3  0x0814c185 in zif_mcrypt_generic (ht=2, return_value=0x83cc264, this_ptr=0x0, return_value_used=1) at mcrypt.c:566
#4  0x081aae6a in execute (op_array=0x83c1e8c) at ./zend_execute.c:1590
#5  0x080e5239 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at zend.c:814
#6  0x080801c1 in php_execute_script (primary_file=0xbffff7f0) at main.c:1307
#7  0x0807a8cc in main (argc=3, argv=0xbffff864) at cgi_main.c:738
#8  0x404f19cb in __libc_start_main (main=0x8079f34 <main>, argc=3, argv=0xbffff864, init=0x8076e1c <_init>, 
    fini=0x82310d0 <_fini>, rtld_fini=0x4000aea0 <_dl_fini>, stack_end=0xbffff85c) at ../sysdeps/generic/libc-start.c:92

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-12-25 11:31 UTC] derick@php.net
Fixed in CVS, this will be in 4.1.1

Derick
 [2001-12-25 11:36 UTC] sitnikov at infonet dot ee
?an you send me patch ?
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue May 06 04:01:30 2025 UTC