php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37244 base64_decode violates RFC 3548
Submitted: 2006-04-29 13:58 UTC Modified: 2006-05-06 22:47 UTC
From: nohn@php.net Assigned: iliaa (profile)
Status: Closed Package: URL related
PHP Version: 5CVS-2006-04-29 (CVS) OS: Irrelevant
Private report: No CVE-ID: None
 [2006-04-29 13:58 UTC] nohn@php.net
Description:
------------
base64_decode violates RFC 3548:

"Implementations MUST reject the encoding if it contains characters outside the base alphabet when interpreting base encoded data, unless the specification referring to this document explicitly states otherwise."

Reproduce code:
---------------
<?php
$strings = array(
                 'SW1wbGVtZW50YXRpb25zIE1VU1QgcmVqZWN0IHRoZSBlbmNvZGluZyBpZiBpdCBjb250YWlucyBjaGFyYWN0ZXJzIG91dHNpZGUgdGhlIGJhc2UgYWxwaGFiZXQu',
                 'SW1wbGVtZW$0YXRpb25zIE1VU1QgcmVqZWN0IHRoZSBlbmNvZGluZyBpZiBpdCBjb250YWlucyBjaGFyYWN0ZXJzIG91dHNpZGUgdGhlIGJhc2UgYWxwaGFiZXQu',
                 'SW1wbGVtZW0YXRpb25zIE1VU1QgcmVqZWN0IHRoZSBlbmNvZGluZyBpZiBpdCBjb250YWlucyBjaGFyYWN0ZXJzIG91dHNpZGUgdGhlIGJhc2UgYWxwaGFiZXQu'
                 );
foreach($strings as $string) {
  var_dump(base64_decode($string));
}
?>

Expected result:
----------------
string(93) "Implementations MUST reject the encoding if it contains characters outside the base alphabet."
bool(false)
string(92) "Implemem][??UTZXH[??[?Y??Z[??\X?\??]?YHH\?H[X]"





Actual result:
--------------
string(93) "Implementations MUST reject the encoding if it contains characters outside the base alphabet."
string(92) "Implemem][??UTZXH[??[?Y??Z[??\X?\??]?YHH\?H[X]"
string(92) "Implemem][??UTZXH[??[?Y??Z[??\X?\??]?YHH\?H[X]"






Patches

Membership (last revision 2012-09-27 01:25 UTC by ekutkut2002 at hotmail dot com)

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-06 22:47 UTC] iliaa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 13:01:29 2024 UTC