srinatar                                 Fri, 02 Oct 2009 00:13:53 +0000

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

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

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

Modified: php/php-src/branches/PHP_5_2/NEWS
===================================================================
--- php/php-src/branches/PHP_5_2/NEWS   2009-10-01 23:51:33 UTC (rev 289075)
+++ php/php-src/branches/PHP_5_2/NEWS   2009-10-02 00:13:53 UTC (rev 289076)
@@ -20,6 +20,8 @@
 - Fixed bug #49528 (UTF-16 strings prefixed by BOMs wrongly converted).
   (Moriyoshi)
 - Fixed bug #48805 (IPv6 socket transport is not working). (Ilia)
+- Fixed bug #49738 (calling mcrypt after mcrypt_generic_deinit crashes).
+  (Sriram Natarajan)

 17 Sep 2009, PHP 5.2.11
 - Fixed certificate validation inside php_openssl_apply_verification_policy.

Modified: php/php-src/branches/PHP_5_2/ext/mcrypt/mcrypt.c
===================================================================
--- php/php-src/branches/PHP_5_2/ext/mcrypt/mcrypt.c    2009-10-01 23:51:33 UTC 
(rev 289075)
+++ php/php-src/branches/PHP_5_2/ext/mcrypt/mcrypt.c    2009-10-02 00:13:53 UTC 
(rev 289076)
@@ -613,6 +613,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_2/ext/mcrypt/tests/bug49738.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/ext/mcrypt/tests/bug49738.phpt                 
        (rev 0)
+++ php/php-src/branches/PHP_5_2/ext/mcrypt/tests/bug49738.phpt 2009-10-02 
00:13:53 UTC (rev 289076)
@@ -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

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2009-10-01 23:51:33 UTC (rev 289075)
+++ php/php-src/branches/PHP_5_3/NEWS   2009-10-02 00:13:53 UTC (rev 289076)
@@ -25,6 +25,8 @@
 - 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?

Modified: php/php-src/branches/PHP_5_3/ext/mcrypt/mcrypt.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mcrypt/mcrypt.c    2009-10-01 23:51:33 UTC 
(rev 289075)
+++ php/php-src/branches/PHP_5_3/ext/mcrypt/mcrypt.c    2009-10-02 00:13:53 UTC 
(rev 289076)
@@ -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/ext/mcrypt/tests/bug49738.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mcrypt/tests/bug49738.phpt                 
        (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/mcrypt/tests/bug49738.phpt 2009-10-02 
00:13:53 UTC (rev 289076)
@@ -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

Modified: php/php-src/trunk/ext/mcrypt/mcrypt.c
===================================================================
--- php/php-src/trunk/ext/mcrypt/mcrypt.c       2009-10-01 23:51:33 UTC (rev 
289075)
+++ php/php-src/trunk/ext/mcrypt/mcrypt.c       2009-10-02 00:13:53 UTC (rev 
289076)
@@ -693,6 +693,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/trunk/ext/mcrypt/tests/bug49738.phpt
===================================================================
--- php/php-src/trunk/ext/mcrypt/tests/bug49738.phpt                            
(rev 0)
+++ php/php-src/trunk/ext/mcrypt/tests/bug49738.phpt    2009-10-02 00:13:53 UTC 
(rev 289076)
@@ -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