summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-01-30 12:52:41 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-01-30 12:52:41 +0000
commit0347be3e4b7d42aa25a92df2794ef8f3131cda5b (patch)
treeed54063bc0780be9034d4088b0d2779d12d21da0
parentac503968956c25e68d76fc5e60414c281898e2ea (diff)
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) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@26503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ext/dl/dl.c1
-rw-r--r--ext/dl/handle.c1
-rw-r--r--test/dl/test_handle.rb27
-rw-r--r--version.h2
4 files changed, 29 insertions, 2 deletions
diff --git a/ext/dl/dl.c b/ext/dl/dl.c
index 0427dfb3f3..7a21fa9d25 100644
--- a/ext/dl/dl.c
+++ b/ext/dl/dl.c
@@ -13,7 +13,6 @@ ID rbdl_id_stdcall;
VALUE
rb_dl_dlopen(int argc, VALUE argv[], VALUE self)
{
- rb_secure(2);
return rb_class_new_instance(argc, argv, rb_cDLHandle);
}
diff --git a/ext/dl/handle.c b/ext/dl/handle.c
index d72f725fbb..e54bde3cd6 100644
--- a/ext/dl/handle.c
+++ b/ext/dl/handle.c
@@ -68,6 +68,7 @@ rb_dlhandle_initialize(int argc, VALUE argv[], VALUE self)
default:
rb_bug("rb_dlhandle_new");
}
+ rb_secure(2);
ptr = dlopen(clib, cflag);
#if defined(HAVE_DLERROR)
diff --git a/test/dl/test_handle.rb b/test/dl/test_handle.rb
new file mode 100644
index 0000000000..d46e16c084
--- /dev/null
+++ b/test/dl/test_handle.rb
@@ -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
diff --git a/version.h b/version.h
index f97eedee15..b594fe23e2 100644
--- a/version.h
+++ b/version.h
@@ -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