Skip to content

Commit

Permalink
Add mrb_hash_modify() to Hash#{delete,clear}; ref #3370
Browse files Browse the repository at this point in the history
This issue was reported by https://hackerone.com/an0n-j
  • Loading branch information
matz committed Jan 5, 2017
1 parent bc1259d commit 2e0c2b5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,7 @@ mrb_hash_delete(mrb_state *mrb, mrb_value self)
mrb_value key;

mrb_get_args(mrb, "o", &key);
mrb_hash_modify(mrb, self);
return mrb_hash_delete_key(mrb, self, key);
}

Expand Down Expand Up @@ -620,6 +621,7 @@ mrb_hash_clear(mrb_state *mrb, mrb_value hash)
{
khash_t(ht) *h = RHASH_TBL(hash);

mrb_hash_modify(mrb, hash);
if (h) kh_clear(ht, mrb, h);
return hash;
}
Expand Down

0 comments on commit 2e0c2b5

Please sign in to comment.