GitHub user sithas opened a pull request:
https://github.com/apache/thrift/pull/1463
JSONProtocol Base64 Encoding: Do not trim padding on encode.
* In the C# and .NET Core libraries, the JSONProtocol's Binary Encoding to
Base64 trims padding from the user provided byte arrays before encoding into
Base64. This behavior is incorrect, as the user provided data should be encoded
exactly as provided. Otherwise, data may be lost.
* Fixed by no longer trimming padding on encode. Padding must still be
trimmed on decode, in accordance with the Base64 specification.
* For example:
* Before this patch, encoding the byte array `[0x01, 0x3d, 0x3d]` yields
`[0x01]` upon decode. This is incorrect, as I should decode the exact data that
I encoded.
* After this patch, it yields `[0x01, 0x3d, 0x3d]`, as expected.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/sithas/thrift master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/thrift/pull/1463.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1463
----
commit 4cdf1f4a332d5f14923fdc2929321664de1d3c8d
Author: Allen Warthen <allen.warthen@...>
Date: 2018-01-09T17:04:14Z
JSONProtocol Base64 Encoding: Do not trim padding on encode.
- In the C# and .NET Core libraries, the JSONProtocol's Binary Encoding
to Base64 trims padding from the user provided byte arrays before
encoding into base64. This behaviour is incorrect, as the user provided
bytes should be encoded exactly as they are provided. Otherwise, data
may be lost.
- Fixed by no longer trimming padding on encode.
----
---