summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--ext/mcrypt/mcrypt.c1
-rw-r--r--ext/mcrypt/tests/bug49738.phpt13
3 files changed, 16 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 9fdbb82f61..29beec2808 100644
--- 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?
diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c
index 1a5646eac1..d14809a504 100644
--- a/ext/mcrypt/mcrypt.c
+++ b/ext/mcrypt/mcrypt.c
@@ -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
index 0000000000..8f01bec496
--- /dev/null
+++ b/ext/mcrypt/tests/bug49738.phpt
@@ -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