php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48445 Data with special chars breaks execution
Submitted: 2009-06-01 13:09 UTC Modified: 2009-09-26 01:00 UTC
From: cristianrossi dot udesc at gmail dot com Assigned:
Status: No Feedback Package: mcrypt related
PHP Version: 5.2CVS-2009-06-01 (snap) OS: Linux debian 2.6.18-4-686
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2009-06-01 13:09 UTC] 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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-18 19:06 UTC] jani@php.net
Please try using this snapshot:

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

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


 [2009-09-26 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 05:01:28 2024 UTC