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

ruby-changes:29828

From: nobu <ko1@a...>
Date: Wed, 10 Jul 2013 11:20:00 +0900 (JST)
Subject: [ruby-changes:29828] nobu:r41880 (trunk): ossl.c: check allocation

nobu	2013-07-10 11:19:50 +0900 (Wed, 10 Jul 2013)

  New Revision: 41880

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41880

  Log:
    ossl.c: check allocation
    
    * ext/openssl/ossl.c (Init_ossl_locks): check if locks array is
      allocated successfully.

  Modified files:
    trunk/ext/openssl/ossl.c

Index: ext/openssl/ossl.c
===================================================================
--- ext/openssl/ossl.c	(revision 41879)
+++ ext/openssl/ossl.c	(revision 41880)
@@ -486,6 +486,9 @@ static void Init_ossl_locks(void) https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl.c#L486
 	rb_raise(rb_eRuntimeError, "CRYPTO_num_locks() is too big: %d", num_locks);
     }
     ossl_locks = (VALUE*) OPENSSL_malloc(num_locks * (int)sizeof(VALUE));
+    if (!ossl_locks) {
+	rb_raise(rb_eNoMemError, "CRYPTO_num_locks() is too big: %d", num_locks);
+    }
     for (i = 0; i < num_locks; i++) {
 	ossl_locks[i] = rb_mutex_new();
 	rb_global_variable(&(ossl_locks[i]));

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

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