summaryrefslogtreecommitdiff
path: root/test/dl/test_cptr.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-28 03:32:52 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-28 03:32:52 +0000
commiteda13c7ee2e3946790edad7e84740359367c90fa (patch)
treea3336b45e1d36a19b11bbfa98bf825e1b37efd11 /test/dl/test_cptr.rb
parentad8ab9c0132fd5b90187b1ba2825d1fd9eaebe14 (diff)
* ext/dl/cptr.c (rb_dlptr_aref, rb_dlptr_aset): check NULL pointer
dereference. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/dl/test_cptr.rb')
-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