ID:               48445
 Updated by:       j...@php.net
 Reported By:      cristianrossi dot udesc at gmail dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         mcrypt related
 Operating System: Linux debian 2.6.18-4-686
 PHP Version:      5.2CVS-2009-06-01 (snap)
 New Comment:

Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/




Previous Comments:
------------------------------------------------------------------------

[2009-06-01 13:09:28] cristianrossi dot udesc at gmail dot com

Description:
------------
When data to be encrypted has some special chars the mcrypt_generic
function breaks execution.

Reproduce code:
---------------
$wrong_data ="<?xml version='1.0' encoding='UTF-8'>
<root>
   <data>0123456789</data>
</root>";

$correct_data ="<? xml version='1.0' encoding='UTF-8'>
<root>
   <data>0123456789</data>
</root>";

//cypher
$mcrypt_cypher = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '',
MCRYPT_MODE_ECB, '');

//initialization code: mcrypt with mcrypt_generic_init and a 256 key


//trying to encrypt the correct data
$cipherText_correct = mcrypt_generic($mcrypt_cypher, $correct_data);
echo $cipherText_correct;

//trying to encrypt the wrong data
$cipherText_wrong = mcrypt_generic($mcrypt_cypher, $wrong_data);
echo $cipherText_wrong;

Expected result:
----------------
Expected data to be correctly encrypted given it is just a simple
string.

Actual result:
--------------
$correct_data is encrypted correctly. (with a space after "?" -> '<?
xml')

$wrong_data simply breaks the execution. (without space after "?" ->
'<?xml')


It is worth to know the code written above is correctly initialized and
wrong_data and correct_data were 2 different executions.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=48445&edit=1

Reply via email to