Skip to content

Commit fb29941

Browse files
committed
make sure mrb_hash_foreach cant mutate itself
1 parent 49d216f commit fb29941

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/mrb_cbor.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,7 +1371,11 @@ encode_proc_tag(mrb_state *mrb, CborWriter *w, mrb_value obj)
13711371
{
13721372
mrb_value proc_rev = cbor_proc_tag_rev_registry(mrb);
13731373
struct proc_tag_foreach_arg a = {w, obj, FALSE };
1374+
struct RBasic *basic_ptr = mrb_basic_ptr(proc_rev);
1375+
unsigned int was_frozen = basic_ptr->frozen;
1376+
basic_ptr->frozen = TRUE;
13741377
mrb_hash_foreach(mrb, mrb_hash_ptr(proc_rev), proc_tag_foreach_cb, &a);
1378+
basic_ptr->frozen = was_frozen;
13751379
return a.found;
13761380
}
13771381

0 commit comments

Comments
 (0)