summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-23 05:49:43 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-23 05:49:43 +0000
commitc20a1946a6d7b260f1f0f3038b7af081174d6cd9 (patch)
treee62af298aac15c9fc3c4a5a7bb087c08201ec225 /eval.c
parent9777547817c775cb2e767083385090dd79f77fff (diff)
Restrict cause to an exception object [Bug #15447]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/eval.c b/eval.c
index ecb79cc..0a676ef 100644
--- a/eval.c
+++ b/eval.c
@@ -509,6 +509,9 @@ exc_setup_message(const rb_execution_context_t *ec, VALUE mesg, VALUE *cause)
*cause = get_ec_errinfo(ec);
}
}
+ else if (!NIL_P(*cause) && !rb_obj_is_kind_of(*cause, rb_eException)) {
+ rb_raise(rb_eTypeError, "exception object expected");
+ }
return mesg;
}