]> granicus.if.org Git - php/commitdiff
- Merge: Fixed bug #49738 (calling mcrypt after mcrypt_generic_deinit crashes)
authorPierre Joye <pajoye@php.net>
Fri, 9 Oct 2009 17:28:52 +0000 (17:28 +0000)
committerPierre Joye <pajoye@php.net>
Fri, 9 Oct 2009 17:28:52 +0000 (17:28 +0000)
ext/mcrypt/mcrypt.c
ext/mcrypt/tests/bug49738.phpt [new file with mode: 0644]

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