pajoye                                   Fri, 09 Oct 2009 17:28:52 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=289433

Log:
- Merge: Fixed bug #49738 (calling mcrypt after mcrypt_generic_deinit crashes)

Bug: http://bugs.php.net/49738 (Closed) calling mcrypt after 
mcrypt_generic_deinit crashes
      
Changed paths:
    U   php/php-src/branches/PHP_5_3_1/ext/mcrypt/mcrypt.c
    A   php/php-src/branches/PHP_5_3_1/ext/mcrypt/tests/bug49738.phpt

Modified: php/php-src/branches/PHP_5_3_1/ext/mcrypt/mcrypt.c
===================================================================
--- php/php-src/branches/PHP_5_3_1/ext/mcrypt/mcrypt.c  2009-10-09 17:23:01 UTC 
(rev 289432)
+++ php/php-src/branches/PHP_5_3_1/ext/mcrypt/mcrypt.c  2009-10-09 17:28:52 UTC 
(rev 289433)
@@ -780,6 +780,7 @@
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not 
terminate encryption specifier");
                RETURN_FALSE
        }
+       pm->init = 0;
        RETURN_TRUE
 }
 /* }}} */

Added: php/php-src/branches/PHP_5_3_1/ext/mcrypt/tests/bug49738.phpt
===================================================================
--- php/php-src/branches/PHP_5_3_1/ext/mcrypt/tests/bug49738.phpt               
                (rev 0)
+++ php/php-src/branches/PHP_5_3_1/ext/mcrypt/tests/bug49738.phpt       
2009-10-09 17:28:52 UTC (rev 289433)
@@ -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

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to