From: terrafr...@php.net Operating system: Windows XP PHP version: 5.2.11 PHP Bug Type: mcrypt related Bug description: calling mcrypt after mcrypt_generic_deinit crashes
Description: ------------ In bug # 41252, it was observed that, in PHP4, calling mcrypt_generic() before calling mcrypt_module_open() would cause PHP4 to crash. PHP5 apparently had extra checks to protect against this that were backported. These extra checks, however, do not appear to be sufficient, as the following reproduce code demonstrates. Sure, calling mcrypt_generic_deinit() before calling mcrypt_generic is probably not something you ought to be doing, anyway, but I still don't think it ought to crash PHP. Reproduce code: --------------- <?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'); ?> Expected result: ---------------- Warning: mcrypt_generic(): Operation disallowed prior to mcrypt_generic_init() in {filename} on line 5 Actual result: -------------- It crashes. -- Edit bug report at http://bugs.php.net/?id=49738&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49738&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49738&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49738&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49738&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49738&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49738&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49738&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49738&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49738&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49738&r=support Expected behavior: http://bugs.php.net/fix.php?id=49738&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49738&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49738&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49738&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49738&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49738&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49738&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49738&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49738&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49738&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49738&r=mysqlcfg