Bug #80870 [NEW]: base64_decode: Concatenated base64 blocks are corrupted
From: bugs at jth dot net
Operating system: Linux
PHP version: 7.4.16
Package: Unknown/Other Function
Bug Type: Bug
Bug description:base64_decode: Concatenated base64 blocks are corrupted
Description:
------------
When decoding a string containing two or more base64 blocks with line
feeds in the base64 text the latter blocks are corrupted.
This may occur as input from an email generated by some mail programs.
Test script:
---------------
$s1 = base64_encode("Line nr 1 bcdefg\n");
$s2 = base64_encode("Line nr 2 \n");
$str = $s1."\n".$s2;
echo $str
echo base64_decode($str);
Expected result:
----------------
TGluZSBuciAxIGJjZGVmZwo=
TGluZSBuciAyIAo=
Line nr 1 bcdefg
Line nr 2
Actual result:
--------------
Result:
TGluZSBuciAxIGJjZGVmZwo=
TGluZSBuciAyIAo=
Line nr 1 bcdefg
(corrupted text)
--
Edit bug report at https://bugs.php.net/bug.php?id=80870&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80870&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80870&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80870&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80870&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80870&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80870&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80870&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80870&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80870&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80870&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80870&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80870&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80870&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80870&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80870&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80870&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80870&r=mysqlcfg
Thread (19 messages)
- bugs at jth dot net
- requinix@php.netBug #80870 [Opn->Fbk]: base64_decode: Concatenated base64 blocks are corrupted
- bugs at jth dot netBug #80870 [Fbk->Opn]: base64_decode: Concatenated base64 blocks are corrupted
- dgdgeg dot evrgrh at ggg dot agBug #80870 [Com]: base64_decode: Concatenated base64 blocks are corrupted
- bugs at jth dot netBug #80870 [Opn]: base64_decode: Concatenated base64 blocks are corrupted
- bugs at jth dot netBug #80870 [Com]: base64_decode: Concatenated base64 blocks are corrupted
- bugs at jth dot netBug #80870 [Opn]: base64_decode: Concatenated base64 blocks are corrupted
- iguv dot jdzx at ghjj dot sddrBug #80870 [Com]: base64_decode: Concatenated base64 blocks are corrupted
- cmb@php.netBug #80870 [Opn->Nab]: base64_decode: Concatenated base64 blocks are corrupted
- bugs at jth dot netBug #80870 [Nab]: base64_decode: Concatenated base64 blocks are corrupted
- rtrtrtrtrt at dfdfdfdf dot dfdBug #80870 [Com]: base64_decode: Concatenated base64 blocks are corrupted
- bugs at jth dot netBug #80870 [Nab]: base64_decode: Concatenated base64 blocks are corrupted
- requinix@php.netBug->Req #80870 [Nab->Opn]: base64_decode: Support a "stream" of multiple encoded strings
- bugs@jth.netReq #80870 [PATCH]: base64_decode: Support a "stream" of multiple encoded strings
- bugs@jth.netReq #80870 [PATCH]: base64_decode: Support a "stream" of multiple encoded strings
- bugs at jth dot netReq #80870 [Com]: base64_decode: Support a "stream" of multiple encoded strings
- a at b dot c dot deReq #80870 [Com]: base64_decode: Support a "stream" of multiple encoded strings
- bugs at jth dot netReq #80870 [Opn]: base64_decode: Support a "stream" of multiple encoded strings
- a at b dot c dot deReq #80870 [Com]: base64_decode: Support a "stream" of multiple encoded strings