summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authorKenichi Kamiya <kachick1@gmail.com>2021-03-22 14:10:52 +0900
committerGitHub <noreply@github.com>2021-03-22 14:10:52 +0900
commit7d3fdfb27dac456827b004d9e66a44b15f8cd762 (patch)
tree6875ffdbe8b19c41a94c2915dade052bcbf5011a /hash.c
parentdb0ad48309edae28a65e3d18e9b3a15753eda777 (diff)
Hash#transform_values! ensures receiver modifiable in block [Bug #17736]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4302 Merged-By: nobu <nobu@ruby-lang.org>
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hash.c b/hash.c
index 2cfdbad69b..27111685dc 100644
--- a/hash.c
+++ b/hash.c
@@ -3303,6 +3303,7 @@ transform_values_foreach_replace(st_data_t *key, st_data_t *value, st_data_t arg
{
VALUE new_value = rb_yield((VALUE)*value);
VALUE hash = (VALUE)argp;
+ rb_hash_modify(hash);
RB_OBJ_WRITE(hash, value, new_value);
return ST_CONTINUE;
}