diff --git a/ChangeLog b/ChangeLog index e3106401db..ad1704688a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Mon May 23 21:09:06 2016 Kazuki Yamaguchi + + * ext/openssl/ossl.c (Init_openssl): Avoid reference to unset global + variable. ossl_raise() may be called before dOSSL is set. Since + global variables default to 0 and the default value of dOSSL set in + Init_openssl() is also Qfalse, there is no real issue but confusing. + Patch by Bertram Scharpf + [ruby-core:58264] [Bug #9101] + Mon May 23 20:32:16 2016 Kazuki Yamaguchi * ext/openssl/ossl_asn1.c, ext/openssl/ossl_bn.c, diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c index 1f62c57a70..ad9c430de9 100644 --- a/ext/openssl/ossl.c +++ b/ext/openssl/ossl.c @@ -1176,14 +1176,6 @@ Init_openssl(void) eOSSLError = rb_define_class_under(mOSSL,"OpenSSLError",rb_eStandardError); rb_global_variable(&eOSSLError); - /* - * Verify callback Proc index for ext-data - */ - if ((ossl_store_ctx_ex_verify_cb_idx = X509_STORE_CTX_get_ex_new_index(0, (void *)"ossl_store_ctx_ex_verify_cb_idx", 0, 0, 0)) < 0) - ossl_raise(eOSSLError, "X509_STORE_CTX_get_ex_new_index"); - if ((ossl_store_ex_verify_cb_idx = X509_STORE_get_ex_new_index(0, (void *)"ossl_store_ex_verify_cb_idx", 0, 0, 0)) < 0) - ossl_raise(eOSSLError, "X509_STORE_get_ex_new_index"); - /* * Init debug core */ @@ -1194,6 +1186,14 @@ Init_openssl(void) rb_define_module_function(mOSSL, "debug=", ossl_debug_set, 1); rb_define_module_function(mOSSL, "errors", ossl_get_errors, 0); + /* + * Verify callback Proc index for ext-data + */ + if ((ossl_store_ctx_ex_verify_cb_idx = X509_STORE_CTX_get_ex_new_index(0, (void *)"ossl_store_ctx_ex_verify_cb_idx", 0, 0, 0)) < 0) + ossl_raise(eOSSLError, "X509_STORE_CTX_get_ex_new_index"); + if ((ossl_store_ex_verify_cb_idx = X509_STORE_get_ex_new_index(0, (void *)"ossl_store_ex_verify_cb_idx", 0, 0, 0)) < 0) + ossl_raise(eOSSLError, "X509_STORE_get_ex_new_index"); + /* * Get ID of to_der */