Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java::JavaLang::NullPointerException: org.jruby.RubyString.crypt(RubyString.java:2660) #2342

Closed
mkristian opened this issue Dec 22, 2014 · 3 comments

Comments

@mkristian
Copy link
Member

on current jruby-1_7 branch
$ bin/jruby -Xnative.verbose=true -I"lib" --1.9 -I test/externals/ruby1.9 -I test/externals/ruby1.9/ruby -r ./test/ruby19_env.rb -r minitest/excludes "test/externals/ruby1.9/ruby/test_m17n_comb.rb"
Successfully loaded native POSIX impl.
Run options:

Running tests:

................E..............................

Finished tests in 8.964000s, 5.2432 tests/s, 8112.0036 assertions/s.

  1. Error:
    test_str_crypt(TestM17NComb):
    Java::JavaLang::NullPointerException:
    org.jruby.RubyString.crypt(RubyString.java:2660)
    org.jruby.RubyString$INVOKER$i$1$0$crypt.call(RubyString$INVOKER$i$1$0$crypt.gen)
    org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:326)
    org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
    test.externals.ruby1_dot_9.ruby.test_m17n_comb.block_82$RUBY$test_str_crypt(test/externals/ruby1.9/ruby/test_m17n_comb.rb:795)
    test$externals$ruby1_dot_9$ruby$test_m17n_comb$block_82$RUBY$test_str_crypt.call(test$externals$ruby1_dot_9$ruby$test_m17n_comb$block_82$RUBY$test_str_crypt)
    org.jruby.runtime.CompiledBlock19.yield(CompiledBlock19.java:135)
    org.jruby.runtime.CompiledBlock19.yieldSpecific(CompiledBlock19.java:97)
    org.jruby.runtime.Block.yieldSpecific(Block.java:120)
    org.jruby.ast.YieldOneNode.interpret(YieldOneNode.java:35)
@mkristian mkristian added this to the JRuby 1.7.18 milestone Dec 22, 2014
@mkristian
Copy link
Member Author

I did not investigate (yet) but it is there for some time and older jruby versions (1.7.16, 15 for example) but jruby-1.7.17 shows the same error.

@mkristian
Copy link
Member Author

ah - I forgot to mention that I am running ubuntu 14.10

enebo added a commit that referenced this issue Dec 22, 2014
@enebo
Copy link
Member

enebo commented Dec 22, 2014

So the solution to this was to have a null return raise whatever errno provides (in the case of these tests EINVAL). This seems like the most logical way to handle errors in crypt to me. MRI if it detects non-ascii salts it uses first two bytes of whatever the salt is and the or's them to make sure they fit into ascii space. Then they use that? I don't understand the reasoning behind this but I highly doubt anyone is depending on this behavior because it only works for crypt with DES which increasingly is not used by anyone. I would also be a little disturbed if I was using DES and provided a salt and then saw that the salt was not preserved in the generated crypt string.

@enebo enebo closed this as completed Dec 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants