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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: cristianrossi dot udesc at gmail dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 21:01:35 2025 UTC