#48445 [NEW]: Data with special chars breaks execution
| From: | cristianrossi dot udesc at gmail dot com | Date: | Mon, 01 Jun 2009 13:09:28 +0000 |
| Subject: | #48445 [NEW]: Data with special chars breaks execution | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-137947@lists.php.net to get a copy of this message | ||
From: cristianrossi dot udesc at gmail dot com
Operating system: Linux debian 2.6.18-4-686
PHP version: 5.2CVS-2009-06-01 (snap)
PHP Bug Type: mcrypt related
Bug description: Data with special chars breaks execution
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 bug report at http://bugs.php.net/?id=48445&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48445&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48445&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48445&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=48445&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48445&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=48445&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=48445&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=48445&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=48445&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=48445&r=support
Expected behavior: http://bugs.php.net/fix.php?id=48445&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=48445&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=48445&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=48445&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48445&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48445&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=48445&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=48445&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=48445&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=48445&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=48445&r=mysqlcfg