PHP :: Bug #37244 :: base64_decode violates RFC 3548
| 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
History
AllCommentsChangesGit/SVN commits
[2006-05-06 22:47 UTC] iliaa@php.net