fix possible arena overflow

This commit is contained in:
take_cheeze
2014-02-22 00:05:05 +09:00
parent 36e234aa37
commit a9af8c9c07
+3 -1
View File
@@ -23,12 +23,14 @@ static mrb_value
hash_values_at(mrb_state *mrb, mrb_value hash)
{
mrb_value *argv, result;
int argc, i;
int argc, i, ai;
mrb_get_args(mrb, "*", &argv, &argc);
result = mrb_ary_new_capa(mrb, argc);
ai = mrb_gc_arena_save(mrb);
for (i = 0; i < argc; i++) {
mrb_ary_push(mrb, result, mrb_hash_get(mrb, hash, argv[i]));
mrb_gc_arena_restore(mrb, ai);
}
return result;
}