[前][次][番号順一覧][スレッド一覧]

ruby-changes:43061

From: rhe <ko1@a...>
Date: Mon, 23 May 2016 21:10:44 +0900 (JST)
Subject: [ruby-changes:43061] rhe:r55135 (trunk): openssl: Avoid reference to unset global variable in Init_openssl()

rhe	2016-05-23 21:10:38 +0900 (Mon, 23 May 2016)

  New Revision: 55135

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55135

  Log:
    openssl: Avoid reference to unset global variable in Init_openssl()
    
    * 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 <software@b...>
      [ruby-core:58264] [Bug #9101]

  Modified files:
    trunk/ChangeLog
    trunk/ext/openssl/ossl.c
Index: ext/openssl/ossl.c
===================================================================
--- ext/openssl/ossl.c	(revision 55134)
+++ ext/openssl/ossl.c	(revision 55135)
@@ -1177,14 +1177,6 @@ Init_openssl(void) https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl.c#L1177
     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
      */
     dOSSL = Qfalse;
@@ -1195,6 +1187,14 @@ Init_openssl(void) https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl.c#L1187
     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
      */
     ossl_s_to_der = rb_intern("to_der");
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 55134)
+++ ChangeLog	(revision 55135)
@@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon May 23 21:09:06 2016  Kazuki Yamaguchi  <k@r...>
+
+	* 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 <software@b...>
+	  [ruby-core:58264] [Bug #9101]
+
 Mon May 23 20:32:16 2016  Kazuki Yamaguchi  <k@r...>
 
 	* ext/openssl/ossl_asn1.c, ext/openssl/ossl_bn.c,

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]