Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

better rewrite r5186

git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/trunk@5187 23306eb0-4c56-4727-a40e-e92c0eb68959
  • Loading branch information...
commit 7280ac3fb4b3f999bacae04ea311995a3c507c82 1 parent a9c28b8
Laurent Sansonetti authored
Showing with 8 additions and 5 deletions.
  1. +8 −5 hash.h
View
13 hash.h
@@ -41,11 +41,14 @@ rb_klass_is_rhash(VALUE klass)
static inline void
rhash_modify(VALUE hash)
{
- if (OBJ_FROZEN(hash)) {
- rb_error_frozen("hash");
- }
- if (!OBJ_UNTRUSTED(hash) && rb_safe_level() >= 4) {
- rb_raise(rb_eSecurityError, "Insecure: can't modify hash");
+ const long mask = RBASIC(hash)->flags;
+ if ((mask & FL_FREEZE) == FL_FREEZE) {
+ rb_raise(rb_eRuntimeError, "can't modify frozen/immutable hash");
+ }
+ if ((mask & FL_UNTRUSTED) == FL_UNTRUSTED) {
+ if (rb_safe_level() >= 4) {
+ rb_raise(rb_eSecurityError, "Insecure: can't modify hash");
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.