JRuby version: jruby 9.1.2.0 (2.3.0) 2016-05-26 7357c8f OpenJDK 64-Bit Server VM 25.91-b14 on 1.8.0_91-8u91-b14-1~bpo8+1-b14 +jit [linux-x86_64]
No special command line arguments.
OS: Linux 29ea782aaebe 4.4.15-boot2docker #1 SMP Wed Jul 13 14:05:46 UTC 2016 x86_64 GNU/Linux
As you can see, JRuby doesn't detect missing paddings and incorrectly decodes the string (ignores the last three-octet group). Here's a workaround I use:
Environment
JRuby version:
jruby 9.1.2.0 (2.3.0) 2016-05-26 7357c8f OpenJDK 64-Bit Server VM 25.91-b14 on 1.8.0_91-8u91-b14-1~bpo8+1-b14 +jit [linux-x86_64]
No special command line arguments.
OS:
Linux 29ea782aaebe 4.4.15-boot2docker #1 SMP Wed Jul 13 14:05:46 UTC 2016 x86_64 GNU/Linux
Expected Behavior
MRI (ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]):
As you can see, MRI correctly determines if a string is missing Base64 paddings and correctly decodes the string.
Actual Behavior
JRuby:
As you can see, JRuby doesn't detect missing paddings and incorrectly decodes the string (ignores the last three-octet group). Here's a workaround I use:
Base64.decode64
usesString#unpack
under the hood. Here's the piece in MRI source codes responsible for the correct implementation: https://github.com/ruby/ruby/blob/trunk/pack.c#L1618The text was updated successfully, but these errors were encountered: