summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-25 18:13:17 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-25 18:13:17 +0000
commitd41018464386c1ce686a65af03fb711a9af1baa1 (patch)
tree1aabc37864c9f6216539240165e29154f7c6573f /vm.c
parentd014f463cf6d5dd51aa2ce56385fc08ac5c121af (diff)
merge revision(s) 57024: [Backport #13015]
vm.c: check type of hash to merge * vm.c (core_hash_merge): check the type of the target hash to merge. [ruby-core:78536] [Bug #13015] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/vm.c b/vm.c
index 78de622d31..615c4c9cc9 100644
--- a/vm.c
+++ b/vm.c
@@ -2345,6 +2345,7 @@ core_hash_merge(VALUE hash, long argc, const VALUE *argv)
{
long i;
+ Check_Type(hash, T_HASH);
assert(argc % 2 == 0);
for (i=0; i<argc; i+=2) {
rb_hash_aset(hash, argv[i], argv[i+1]);
@@ -2366,7 +2367,7 @@ core_hash_from_ary(VALUE ary)
VALUE hash = rb_hash_new();
if (RUBY_DTRACE_HASH_CREATE_ENABLED()) {
- RUBY_DTRACE_HASH_CREATE(RARRAY_LEN(ary), rb_sourcefile(), rb_sourceline());
+ RUBY_DTRACE_HASH_CREATE((Check_Type(ary, T_ARRAY), RARRAY_LEN(ary)), rb_sourcefile(), rb_sourceline());
}
return core_hash_merge_ary(hash, ary);
@@ -2382,6 +2383,7 @@ m_core_hash_merge_ary(VALUE self, VALUE hash, VALUE ary)
static VALUE
core_hash_merge_ary(VALUE hash, VALUE ary)
{
+ Check_Type(ary, T_ARRAY);
core_hash_merge(hash, RARRAY_LEN(ary), RARRAY_CONST_PTR(ary));
return hash;
}