Project

General

Profile

Actions

Bug #4919

closed

OpenSSL::SSL::Sesssion#time= に Bignum を渡すと ArgumentError が発生する

Added by nagachika (Tomoyuki Chikanaga) over 13 years ago. Updated over 13 years ago.

Status:
Closed
Assignee:
-
Target version:
ruby -v:
-
Backport:
[ruby-dev:43869]

Description

掲題のような理由で make test-all TESTS="-v openssl/test_ssl_session.rb" を実行すると 1E になります。

  1. Error:
    test_session(OpenSSL::TestSSLSession):
    ArgumentError: unknown type
    /opt/ruby-trunk/src/ruby/test/openssl/test_ssl_session.rb:21:in time=' /opt/ruby-trunk/src/ruby/test/openssl/test_ssl_session.rb:21:in block in test_session'
    /opt/ruby-trunk/src/ruby/test/openssl/utils.rb:280:in call' /opt/ruby-trunk/src/ruby/test/openssl/utils.rb:280:in start_server'
    /opt/ruby-trunk/src/ruby/test/openssl/test_ssl_session.rb:7:in `test_session'

32bit 版のため Time.now.to_i が Bignum になり、OpenSSL::SSL::Sesssion#time= がこれをエラーとして弾くようです。

とりあえず以下のように Bignum 受け付けるようにしてみたところテストのErrorは回避されました。

--- a/ext/openssl/ossl_ssl_session.c
+++ b/ext/openssl/ossl_ssl_session.c
@@ -149,7 +149,7 @@ static VALUE ossl_ssl_session_get_timeout(VALUE self)

if (rb_obj_is_instance_of(time_v, rb_cTime)) {
time_v = rb_funcall(time_v, rb_intern("to_i"), 0); \

  •           } else if (FIXNUM_P(time_v)) {                                \
    
  •           } else if (FIXNUM_P(time_v) || TYPE(time_v) == T_BIGNUM) {     \
                      ;                                                     \
              } else {                                                      \
                      rb_raise(rb_eArgError, "unknown type");               \
    

Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #4923: [ext/openssl] test_ssl.rb: test_client_auth failsClosedMartinBosslet (Martin Bosslet)06/23/2011Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0