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

ruby-changes:14655

From: yugui <ko1@a...>
Date: Sat, 30 Jan 2010 22:07:09 +0900 (JST)
Subject: [ruby-changes:14655] Ruby:r26503 (ruby_1_9_1): merges r25448 from trunk into ruby_1_9_1.

yugui	2010-01-30 21:52:41 +0900 (Sat, 30 Jan 2010)

  New Revision: 26503

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

  Log:
    merges r25448 from trunk into ruby_1_9_1.
    --
    * ext/ext/dl/handle.c (rb_dlhandle_initialize) added rb_secure(2)
      [ruby-core:25762]
    * ext/dl/dl.c (rb_dl_dlopen) removed rb_secure(2)

  Added files:
    branches/ruby_1_9_1/test/dl/test_handle.rb
  Modified files:
    branches/ruby_1_9_1/ext/dl/dl.c
    branches/ruby_1_9_1/ext/dl/handle.c
    branches/ruby_1_9_1/version.h

Index: ruby_1_9_1/ext/dl/dl.c
===================================================================
--- ruby_1_9_1/ext/dl/dl.c	(revision 26502)
+++ ruby_1_9_1/ext/dl/dl.c	(revision 26503)
@@ -13,7 +13,6 @@
 VALUE
 rb_dl_dlopen(int argc, VALUE argv[], VALUE self)
 {
-    rb_secure(2);
     return rb_class_new_instance(argc, argv, rb_cDLHandle);
 }
 
Index: ruby_1_9_1/ext/dl/handle.c
===================================================================
--- ruby_1_9_1/ext/dl/handle.c	(revision 26502)
+++ ruby_1_9_1/ext/dl/handle.c	(revision 26503)
@@ -68,6 +68,7 @@
   default:
     rb_bug("rb_dlhandle_new");
   }
+  rb_secure(2);
 
   ptr = dlopen(clib, cflag);
 #if defined(HAVE_DLERROR)
Index: ruby_1_9_1/version.h
===================================================================
--- ruby_1_9_1/version.h	(revision 26502)
+++ ruby_1_9_1/version.h	(revision 26503)
@@ -1,5 +1,5 @@
 #define RUBY_VERSION "1.9.1"
-#define RUBY_PATCHLEVEL 408
+#define RUBY_PATCHLEVEL 409
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 9
 #define RUBY_VERSION_TEENY 1
Index: ruby_1_9_1/test/dl/test_handle.rb
===================================================================
--- ruby_1_9_1/test/dl/test_handle.rb	(revision 0)
+++ ruby_1_9_1/test/dl/test_handle.rb	(revision 26503)
@@ -0,0 +1,27 @@
+require 'test_base'
+
+module DL
+  class TestHandle < TestBase
+    def test_dlopen_returns_handle
+      assert_instance_of DL::Handle, dlopen(LIBC_SO)
+    end
+
+    def test_dlopen_safe
+      assert_raises(SecurityError) do
+        Thread.new do
+          $SAFE = 2
+          dlopen(LIBC_SO)
+        end.join
+      end
+    end
+
+    def test_initialize_safe
+      assert_raises(SecurityError) do
+        Thread.new do
+          $SAFE = 2
+          DL::Handle.new(LIBC_SO)
+        end.join
+      end
+    end
+  end
+end

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

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