summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-14 20:05:04 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-14 20:05:04 +0000
commit0c8cfb4eabc5c00e17439a61d274e8c74eefeef2 (patch)
tree7d34f209a3c7c3446d87335c0e5cd400aa23ec4a /test
parent44d3cf03fd13ba0d83aca858cc53e71b71958354 (diff)
merge revision(s) 32720: [Backport #6015]
* ext/dl/cptr.c (rb_dlptr_aref, rb_dlptr_aset): check NULL pointer dereference. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/dl/test_cptr.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/dl/test_cptr.rb b/test/dl/test_cptr.rb
index 953af286e1..c3793859d7 100644
--- a/test/dl/test_cptr.rb
+++ b/test/dl/test_cptr.rb
@@ -212,5 +212,11 @@ module DL
assert_equal ptr3.to_i, ptr[0,2] = ptr3.to_i
check.call(str, ptr)
end
+
+ def test_null_pointer
+ nullpo = CPtr.new(0)
+ assert_raise(DLError) {nullpo[0]}
+ assert_raise(DLError) {nullpo[0] = 1}
+ end
end
end