]> granicus.if.org Git - php/commitdiff
- Fixed bug #49738 (calling mcrypt after mcrypt_generic_deinit crashes).
authorSriram Natarajan <srinatar@php.net>
Fri, 2 Oct 2009 00:13:53 +0000 (00:13 +0000)
committerSriram Natarajan <srinatar@php.net>
Fri, 2 Oct 2009 00:13:53 +0000 (00:13 +0000)
NEWS
ext/mcrypt/mcrypt.c
ext/mcrypt/tests/bug49738.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index ed5d5dabe415d9f084f4ff6a56f9328a1b64a145..50cc72f7f9acdceaec25249ae9695bc026539eb7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -20,6 +20,8 @@
 - Fixed bug #49528 (UTF-16 strings prefixed by BOMs wrongly converted).
   (Moriyoshi)
 - Fixed bug #48805 (IPv6 socket transport is not working). (Ilia)
+- Fixed bug #49738 (calling mcrypt after mcrypt_generic_deinit crashes).
+  (Sriram Natarajan)
 
 17 Sep 2009, PHP 5.2.11
 - Fixed certificate validation inside php_openssl_apply_verification_policy.
index 253c6967b41366f811919e685e98db9fceb7c968..d21318d9e14273826a98796190d2f76543d1f7f5 100644 (file)
@@ -613,6 +613,7 @@ PHP_FUNCTION(mcrypt_generic_deinit)
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not terminate encryption specifier");
                RETURN_FALSE
        }
+       pm->init = 0;
        RETURN_TRUE
 }
 /* }}} */
diff --git a/ext/mcrypt/tests/bug49738.phpt b/ext/mcrypt/tests/bug49738.phpt
new file mode 100644 (file)
index 0000000..8f01bec
--- /dev/null
@@ -0,0 +1,13 @@
+--TEST--
+Bug #49738 (calling mcrypt after mcrypt_generic_deinit crashes)
+--SKIPIF--
+<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
+--FILE--
+<?php
+   $td = mcrypt_module_open(MCRYPT_DES, '', MCRYPT_MODE_ECB, '');
+   mcrypt_generic_init($td, 'aaaaaaaa', 'aaaaaaaa');
+   mcrypt_generic_deinit($td);
+   echo mcrypt_generic($td, 'aaaaaaaa');
+?>
+--EXPECTF--
+Warning: mcrypt_generic(): Operation disallowed prior to mcrypt_generic_init(). in %sbug49738.php on line 5