diff options
| author | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:37:27 -0400 |
|---|---|---|
| committer | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:37:27 -0400 |
| commit | 2d4e5b09576bb4f0ba716cc82cdf29ea04d9184b (patch) | |
| tree | 41ccc042009cba53e4ce43e727fcba4c1cfbf7f3 /ext/mcrypt | |
| parent | d29a4fd2dd3b5d4cf6e80b602544d7b71d794e76 (diff) | |
| download | php-2d4e5b09576bb4f0ba716cc82cdf29ea04d9184b.tar.gz | |
Imported Upstream version 5.2.2upstream/5.2.2
Diffstat (limited to 'ext/mcrypt')
| -rw-r--r-- | ext/mcrypt/config.m4 | 8 | ||||
| -rw-r--r-- | ext/mcrypt/mcrypt.c | 11 | ||||
| -rw-r--r-- | ext/mcrypt/php_mcrypt.h | 4 | ||||
| -rw-r--r-- | ext/mcrypt/tests/bug35496.phpt | 4 | ||||
| -rw-r--r-- | ext/mcrypt/tests/bug41252.phpt | 13 |
5 files changed, 27 insertions, 13 deletions
diff --git a/ext/mcrypt/config.m4 b/ext/mcrypt/config.m4 index 2a36c0a83..c6e979217 100644 --- a/ext/mcrypt/config.m4 +++ b/ext/mcrypt/config.m4 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.31 2005/05/29 23:16:41 sniper Exp $ +dnl $Id: config.m4,v 1.31.4.1 2006/12/23 17:58:47 derick Exp $ dnl AC_DEFUN([PHP_MCRYPT_CHECK_VERSION],[ @@ -45,13 +45,13 @@ if test "$PHP_MCRYPT" != "no"; then ],[ AC_MSG_ERROR([Sorry, I was not able to diagnose which libmcrypt version you have installed.]) ],[ - -L$MCRYPT_DIR/lib + -L$MCRYPT_DIR/$PHP_LIBDIR ]) ],[ - -L$MCRYPT_DIR/lib -lltdl + -L$MCRYPT_DIR/$PHP_LIBDIR -lltdl ]) - PHP_ADD_LIBRARY_WITH_PATH(mcrypt, $MCRYPT_DIR/lib, MCRYPT_SHARED_LIBADD) + PHP_ADD_LIBRARY_WITH_PATH(mcrypt, $MCRYPT_DIR/$PHP_LIBDIR, MCRYPT_SHARED_LIBADD) PHP_ADD_INCLUDE($MCRYPT_DIR/include) PHP_SUBST(MCRYPT_SHARED_LIBADD) diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c index 40b64324a..7457ec8d3 100644 --- a/ext/mcrypt/mcrypt.c +++ b/ext/mcrypt/mcrypt.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | + | Copyright (c) 1997-2007 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ | Derick Rethans <derick@derickrethans.nl> | +----------------------------------------------------------------------+ */ -/* $Id: mcrypt.c,v 1.91.2.3.2.5 2006/06/26 16:33:38 bjori Exp $ */ +/* $Id: mcrypt.c,v 1.91.2.3.2.10 2007/04/05 01:48:56 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -35,6 +35,7 @@ #include "php_ini.h" #include "php_globals.h" #include "ext/standard/info.h" +#include "ext/standard/php_rand.h" static int le_mcrypt; @@ -1242,8 +1243,8 @@ PHP_FUNCTION(mcrypt_create_iv) return; } - if (size <= 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not create an IV with size 0 or smaller"); + if (size <= 0 || size >= INT_MAX) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not create an IV with a size of less then 1 or greater then %d", INT_MAX); RETURN_FALSE; } @@ -1276,7 +1277,7 @@ PHP_FUNCTION(mcrypt_create_iv) } else { n = size; while (size) { - iv[--size] = 255.0 * rand() / RAND_MAX; + iv[--size] = 255.0 * php_rand(TSRMLS_C) / RAND_MAX; } } RETURN_STRINGL(iv, n, 0); diff --git a/ext/mcrypt/php_mcrypt.h b/ext/mcrypt/php_mcrypt.h index 32119e7a2..46b7e92bd 100644 --- a/ext/mcrypt/php_mcrypt.h +++ b/ext/mcrypt/php_mcrypt.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | + | Copyright (c) 1997-2007 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ | Derick Rethans <derick@derickrethans.nl> | +----------------------------------------------------------------------+ */ -/* $Id: php_mcrypt.h,v 1.26.2.1.2.1 2006/06/26 16:33:38 bjori Exp $ */ +/* $Id: php_mcrypt.h,v 1.26.2.1.2.2 2007/01/01 09:36:02 sebastian Exp $ */ #ifndef PHP_MCRYPT_H #define PHP_MCRYPT_H diff --git a/ext/mcrypt/tests/bug35496.phpt b/ext/mcrypt/tests/bug35496.phpt index 9d94ba4ca..3add65e02 100644 --- a/ext/mcrypt/tests/bug35496.phpt +++ b/ext/mcrypt/tests/bug35496.phpt @@ -9,6 +9,6 @@ mcrypt_generic($td, "foobar"); mdecrypt_generic($td, "baz"); ?> --EXPECTF-- -Warning: mcrypt_generic(): Operation disallowed prior to mcrypt_generic_init(). in %s/bug35496.php on line 3 +Warning: mcrypt_generic(): Operation disallowed prior to mcrypt_generic_init(). in %sbug35496.php on line 3 -Warning: mdecrypt_generic(): Operation disallowed prior to mcrypt_generic_init(). in %s/bug35496.php on line 4 +Warning: mdecrypt_generic(): Operation disallowed prior to mcrypt_generic_init(). in %sbug35496.php on line 4 diff --git a/ext/mcrypt/tests/bug41252.phpt b/ext/mcrypt/tests/bug41252.phpt new file mode 100644 index 000000000..481fc5498 --- /dev/null +++ b/ext/mcrypt/tests/bug41252.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #41252 (Calling mcrypt_generic without first calling mcrypt_generic_init crashes) +--SKIPIF-- +<?php if (!extension_loaded("mcrypt")) print "skip"; ?> +--FILE-- +<?php +$td = mcrypt_module_open(MCRYPT_DES, '', MCRYPT_MODE_ECB, ''); +echo mcrypt_generic($td,'aaaaaaaa'); +print "I'm alive!\n"; +?> +--EXPECTF-- +Warning: mcrypt_generic(): Operation disallowed prior to mcrypt_generic_init(). in %sbug41252.php on line 3 +I'm alive! |
