ruby-changes:18698
From: naruse <ko1@a...>
Date: Sun, 30 Jan 2011 03:50:33 +0900 (JST)
Subject: [ruby-changes:18698] Ruby:r30724 (trunk): * ext/openssl/ossl_bn.c (GetBNPtr): add missing nil case.
naruse 2011-01-30 03:48:24 +0900 (Sun, 30 Jan 2011) New Revision: 30724 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30724 Log: * ext/openssl/ossl_bn.c (GetBNPtr): add missing nil case. patched by Martin Bosslet. [ruby-core:34987] Modified files: trunk/ChangeLog trunk/ext/openssl/ossl_bn.c trunk/test/openssl/test_bn.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 30723) +++ ChangeLog (revision 30724) @@ -1,3 +1,8 @@ +Sun Jan 30 03:29:47 2011 NARUSE, Yui <naruse@r...> + + * ext/openssl/ossl_bn.c (GetBNPtr): add missing nil case. + patched by Martin Bosslet. [ruby-core:34987] + Sun Jan 30 01:02:28 2011 KOSAKI Motohiro <kosaki.motohiro@g...> * include/ruby/ruby.h: Added NUM2MODET() and MODET2NUM() default definition. Index: ext/openssl/ossl_bn.c =================================================================== --- ext/openssl/ossl_bn.c (revision 30723) +++ ext/openssl/ossl_bn.c (revision 30724) @@ -70,6 +70,8 @@ } WrapBN(cBN, obj, bn); /* Handle potencial mem leaks */ break; + case T_NIL: + break; default: ossl_raise(rb_eTypeError, "Cannot convert into OpenSSL::BN"); } Index: test/openssl/test_bn.rb =================================================================== --- test/openssl/test_bn.rb (revision 30723) +++ test/openssl/test_bn.rb (revision 30724) @@ -9,9 +9,15 @@ end def test_prime_p - OpenSSL::BN.new((2 ** 107 - 1).to_s(16), 16).prime? - OpenSSL::BN.new((2 ** 127 - 1).to_s(16), 16).prime?(1) + assert_equal(true, OpenSSL::BN.new((2 ** 107 - 1).to_s(16), 16).prime?) + assert_equal(true, OpenSSL::BN.new((2 ** 127 - 1).to_s(16), 16).prime?(1)) end + + def test_cmp_nil + bn = OpenSSL::BN.new('1') + assert_equal(false, bn == nil) + assert_equal(true, bn != nil) + end end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/