diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-07-28 03:32:52 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-07-28 03:32:52 +0000 |
commit | eda13c7ee2e3946790edad7e84740359367c90fa (patch) | |
tree | a3336b45e1d36a19b11bbfa98bf825e1b37efd11 /test/dl | |
parent | ad8ab9c0132fd5b90187b1ba2825d1fd9eaebe14 (diff) | |
download | ruby-eda13c7ee2e3946790edad7e84740359367c90fa.tar.gz |
* 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')
-rw-r--r-- | test/dl/test_cptr.rb | 6 |
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 |