summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/hash.c b/hash.c
index bebb44b3d2..bfead82e8a 100644
--- a/hash.c
+++ b/hash.c
@@ -35,7 +35,7 @@ rb_hash_modify(hash)
{
if (FL_TEST(hash, HASH_FREEZE))
rb_raise(rb_eTypeError, "can't modify frozen hash");
- if (!FL_TEST(hash, FL_TAINT) && rb_safe_level() >= 4)
+ if (!OBJ_TAINTED(hash) && rb_safe_level() >= 4)
rb_raise(rb_eSecurityError, "Insecure: can't modify hash");
}
@@ -43,6 +43,9 @@ VALUE
rb_hash_freeze(hash)
VALUE hash;
{
+ if (rb_safe_level() >= 4 && !OBJ_TAINTED(hash))
+ rb_raise(rb_eSecurityError, "Insecure: can't freeze hash");
+
FL_SET(hash, HASH_FREEZE);
return hash;
}