diff --git a/array.h b/array.h index 4f44716..ef14aee 100644 --- a/array.h +++ b/array.h @@ -45,10 +45,11 @@ rb_klass_is_rary(VALUE klass) static inline void rary_modify(VALUE ary) { - if (OBJ_FROZEN(ary)) { + const long mask = RBASIC(ary)->flags; + if (mask & FL_FREEZE) { rb_error_frozen("array"); } - if (!OBJ_UNTRUSTED(ary) && rb_safe_level() >= 4) { + if (!(mask & FL_UNTRUSTED) && rb_vm_safe_level() >= 4) { rb_raise(rb_eSecurityError, "Insecure: can't modify array"); } } diff --git a/hash.h b/hash.h index 1283209..cf636fd 100644 --- a/hash.h +++ b/hash.h @@ -41,10 +41,11 @@ rb_klass_is_rhash(VALUE klass) static inline void rhash_modify(VALUE hash) { - if (OBJ_FROZEN(hash)) { + const long mask = RBASIC(hash)->flags; + if (mask & FL_FREEZE) { rb_error_frozen("hash"); } - if (!OBJ_UNTRUSTED(hash) && rb_safe_level() >= 4) { + if (!(mask & FL_UNTRUSTED) && rb_vm_safe_level() >= 4) { rb_raise(rb_eSecurityError, "Insecure: can't modify hash"); } }