From 949981f6910ca11149d665e73beb92ef7306a141 Mon Sep 17 00:00:00 2001 From: knu Date: Sun, 11 Mar 2007 08:51:52 +0000 Subject: * ext/dl/mkcallback.rb (mkfunc): Make sure that a callback function is found in the function table before trying to call it; submitted by sheepman in [ruby-dev:30524]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@12029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ ext/dl/mkcallback.rb | 3 +++ 2 files changed, 10 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2addec25aa..5feb8becdb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Sun Mar 11 17:51:46 2007 Akinori MUSHA + + * ext/dl/mkcallback.rb (mkfunc): Make sure that a callback + function is found in the function table before trying to call + it; submitted by sheepman + in [ruby-dev:30524]. + Sun Mar 11 17:30:53 2007 Nobuyoshi Nakada * eval.c (error_handle): no message when exiting by signal. diff --git a/ext/dl/mkcallback.rb b/ext/dl/mkcallback.rb index b7ea1718d0..c9f92e4a0d 100644 --- a/ext/dl/mkcallback.rb +++ b/ext/dl/mkcallback.rb @@ -31,6 +31,9 @@ def mkfunc(rettype, fnum, argc) subst_code, "", " obj = rb_hash_aref(DLFuncTable, rb_assoc_new(INT2NUM(#{rettype.to_s}),INT2NUM(#{fnum.to_s})));", + " if(NIL_P(obj))", + " rb_raise(rb_eDLError, \"callback function does not exist in DL::FuncTable\");", + " Check_Type(obj, T_ARRAY);", " proto = rb_ary_entry(obj, 0);", " proc = rb_ary_entry(obj, 1);", " Check_Type(proto, T_STRING);", -- cgit v1.2.3