-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Description
JRuby's Base64.strict_decode64 doesn't seem to actually be strict. It's easy to reproduce in a REPL.
[5] pry(main)> d = Base64.strict_encode64("hi there")
=> "aGkgdGhlcmU="
[6] pry(main)> Base64.strict_decode64("aGkgdGhlcmU")
=> "hi the"
Using IRB in Ruby 2.0p481, the method actually throws an invalid base64 error.
irb(main):007:0> Base64.strict_encode64("hi there")
=> "aGkgdGhlcmU="
irb(main):008:0> Base64.strict_decode64("aGkgdGhlcmU")
ArgumentError: invalid base64
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/base64.rb:73:in `unpack'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/base64.rb:73:in `strict_decode64'
from (irb):8
from /usr/bin/irb:12:in `<main>'
I took a quick peek, and the Ruby source in the Base64 modules of both versions looks identical. Didn't have time to dive into pack to see what was going on.
Reactions are currently unavailable