Base64 incorrect encoding (file base64.pp)
Original Reporter info from Mantis: AG724
-
Reporter name: Alex
Original Reporter info from Mantis: AG724
- Reporter name: Alex
Description:
If one or two bytes remains in buffer, they will not be encoded.
Therefore, all strings with (length mod 3 in [1,2]) are encoded incorrectly
The bug is here:
base64.pp
function TBase64EncodingStream.Write(const Buffer; Count: Longint): Longint;
...
if ReadNow > Count then break; // Not enough data available
...
Test program attached.
Steps to reproduce:
Run test program
Mantis conversion info:
- Mantis ID: 37035
- OS: Ubuntu
- OS Build: 16.04 LTS Server
- Platform: Linux x86_64
- Version: 3.0.4