From: naomi@humanfactors.edu.au
Operating system: GNU 1.0.3
PHP version: 4.0.6
PHP Bug Type: mcrypt related
Bug description: Empty $key in mcrypt_generic_init causes segmentation fault
Calling mcrypt_generic_init with an empty $key causes a segmentation fault
in Apache. Obviously $key should not be empty, but errors will be made, so
perhaps a parse error could be generated in this event rather than a
crash.
Example Code
<?php
//Open encryption module
$td = mcrypt_module_open (MCRYPT_ARCFOUR, "", MCRYPT_MODE_STREAM, "");
srand ((double) microtime() * 1000000);
$iv = mcrypt_create_iv (mcrypt_enc_get_iv_size ($td), MCRYPT_RAND);
//Encrypt data
$data = "message";
mcrypt_generic_init($td, $key, $iv);//HERE IS THE PROBLEM
$encrypted_data = mcrypt_generic ($td, $data);
mcrypt_generic_end ($td);
?>
--
Edit bug report at: http://bugs.php.net/?id=13052&edit=1