]> 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)
ext/mcrypt/mcrypt.c
ext/mcrypt/tests/bug49738.phpt [new file with mode: 0644]

index 9a3234ace3ba57690e44804b7ccadffa5d01c5bf..d64633f3f571a3480609cb05d301152725cfef2c 100644 (file)
@@ -693,6 +693,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