php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14692 Crash
Submitted: 2001-12-25 10:10 UTC Modified: 2001-12-31 08:22 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
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: sitnikov at infonet dot ee
New email:
PHP Version: OS:

 

 [2001-12-25 10:10 UTC] sitnikov at infonet dot ee
<?
	if (mcrypt_module_is_block_algorithm_mode(MCRYPT_GOST,'/usr'))
		echo "true\n";
	else
		echo "false\n";
?>

#0  0x00000000 in ?? ()
#1  0x4023d8de in mcrypt_module_is_block_algorithm_mode (mode=0x83c1d34 "gost", m_directory=0x83c1dac "/usr")
    at mcrypt_modules.c:610
#2  0x0814d1bf in zif_mcrypt_module_is_block_algorithm_mode (ht=2, return_value=0x83c629c, this_ptr=0x0, return_value_used=1)
    at mcrypt.c:876
#3  0x081aae6a in execute (op_array=0x83c1e8c) at ./zend_execute.c:1590
#4  0x080e5239 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at zend.c:814
#5  0x080801c1 in php_execute_script (primary_file=0xbffff7f0) at main.c:1307
#6  0x0807a8cc in main (argc=3, argv=0xbffff864) at cgi_main.c:738
#7  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

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-12-25 10:13 UTC] sitnikov at infonet dot ee
Crash to:

<?
	if (mcrypt_module_is_block_algorithm_mode(MCRYPT_GOST))
		echo "true\n";
	else
		echo "false\n";
?>

(gdb) bt
#0  0x00000000 in ?? ()
#1  0x4023d8de in mcrypt_module_is_block_algorithm_mode (mode=0x83c1d34 "gost", m_directory=0x0) at mcrypt_modules.c:610
#2  0x0814d1bf in zif_mcrypt_module_is_block_algorithm_mode (ht=1, return_value=0x83c1d6c, this_ptr=0x0, return_value_used=1)
    at mcrypt.c:876
#3  0x081aae6a in execute (op_array=0x83c1e8c) at ./zend_execute.c:1590
#4  0x080e5239 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at zend.c:814
#5  0x080801c1 in php_execute_script (primary_file=0xbffff7f0) at main.c:1307
#6  0x0807a8cc in main (argc=3, argv=0xbffff864) at cgi_main.c:738
#7  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
 [2001-12-25 10:29 UTC] sitnikov at infonet dot ee
libmcrypt-2.4.18
 [2001-12-25 11:09 UTC] derick@php.net
Hello,

your script is buggy, GOST, is not a mode, but an algorithm.
It indeed crashes with this code, but to me it seems like it is an libmcrypt problem.

If you use this:
<?
        if (mcrypt_module_is_block_algorithm(MCRYPT_GOST))
                echo "true\n";
        else
                echo "false\n";
?>

it works, but it returns true if it is NOT a block algorithm, which is a bug in the extension.
(mcrypt returns 1 if it is a block algorithm).

Can you confirm that it does not crash with the script I pasted?

Derick
 [2001-12-25 11:18 UTC] sitnikov at infonet dot ee
I know what it is buggy script, but it not the justification for "Segmentation".

Your script work for me and print "false"


 [2001-12-25 11:18 UTC] sitnikov at infonet dot ee
i use php-4.1.1
 [2001-12-25 11:41 UTC] derick@php.net
This is not a PHP bug, but in libmcrypt. I reported this to the author of the library.
This is the C code I used for it:

#include <unistd.h>
#include <mcrypt.h>

void main (void)
{
    int res;

    res = mcrypt_module_is_block_algorithm ("gost", NULL);
}

This one works, the next does not (segfaults):

#include <unistd.h>
#include <mcrypt.h>

void main (void)
{
    int res;

    res = mcrypt_module_is_block_algorithm_mode ("gost", NULL);
}


regards,
Derick
 [2001-12-26 04:46 UTC] derick@php.net
From: Nikos Mavroyanopoulos <nmav@hellug.gr>
To: mcrypt-dev@lists.hellug.gr
Subject: Re: [mcrypt-dev] Crash

On Tue, 25 Dec 2001 18:57:29 +0100 (CET)
Derick Rethans <d.rethans@jdimedia.nl> wrote:

> Hello,
> I get a crash with the 2nd program (and I know "gost" is not a
> algorithm_mode, but it shouldn't crash IMO).
Yes, it shouldn't crash. I'll check it (after the vacations!).
Thank you.
 [2001-12-31 08:22 UTC] derick@php.net
It's fixed in mcrypt now. This will be in the next release of it (2.4.19).

Derick
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 10 21:01:33 2024 UTC