vm.c: should check type before hash access.

Since the operand of double splat (`**`) may not be a hash, simple
assertion (previous code since d42a64e) was not enough for this case.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2022-02-15 18:36:38 +09:00
parent ecb28f4bf4
commit ff3a5ebed6
+1 -1
View File
@@ -2766,7 +2766,7 @@ RETRY_TRY_BLOCK:
int lim = a+b*2+1;
hash = regs[a];
mrb_assert(mrb_hash_p(hash));
mrb_ensure_hash_type(mrb, hash);
for (i=a+1; i<lim; i+=2) {
mrb_hash_set(mrb, hash, regs[i], regs[i+1]);
}