[macruby-changes] [5187] MacRuby/trunk/hash.h
source_changes at macosforge.org
source_changes at macosforge.org
Fri Jan 21 14:55:29 PST 2011
Revision: 5187
http://trac.macosforge.org/projects/ruby/changeset/5187
Author: lsansonetti at apple.com
Date: 2011-01-21 14:55:29 -0800 (Fri, 21 Jan 2011)
Log Message:
-----------
better rewrite r5186
Revision Links:
--------------
http://trac.macosforge.org/projects/ruby/changeset/5186
Modified Paths:
--------------
MacRuby/trunk/hash.h
Modified: MacRuby/trunk/hash.h
===================================================================
--- MacRuby/trunk/hash.h 2011-01-21 15:51:01 UTC (rev 5186)
+++ MacRuby/trunk/hash.h 2011-01-21 22:55:29 UTC (rev 5187)
@@ -41,12 +41,15 @@
static inline void
rhash_modify(VALUE hash)
{
- if (OBJ_FROZEN(hash)) {
- rb_error_frozen("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");
+ }
}
- if (!OBJ_UNTRUSTED(hash) && rb_safe_level() >= 4) {
- rb_raise(rb_eSecurityError, "Insecure: can't modify hash");
- }
}
static inline long
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20110121/33e57807/attachment.html>
More information about the macruby-changes
mailing list