]> 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 9fdbb82f61ed24a206efddb3e67635d8d911ad74..29beec2808d28ea3216bf74806337b3870991c87 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,8 @@ PHP                                                                        NEWS
 - Fixed bug #48805 (IPv6 socket transport is not working). (Ilia)
 - Fixed PECL bug #16842 (oci_error return false when NO_DATA_FOUND is raised).
   (Chris Jones)
+- Fixed bug #49738 (calling mcrypt after mcrypt_generic_deinit crashes).
+  (Sriram Natarajan)
 
 
 ?? ??? 2009, PHP 5.3.1RC?
index 1a5646eac17d1f8cb41c2b89b2ad5b0d11055cb8..d14809a504cc8fe72e4a6c05a4377cc95f3a3b16 100644 (file)
@@ -780,6 +780,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