diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-05 03:23:32 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-05 03:23:32 +0000 |
commit | eca461acaaae50394a9583481663baf6e3b103ae (patch) | |
tree | c72f106201987fb5a26b3c36b60dc995e5ae1b9f /gc.c | |
parent | 1ecb29fbf81f9fee8e599c51b071d4e4ae558fc1 (diff) |
merge revision(s) 13587:
* gc.c (id2ref): valid id should not refer T_VALUE nor T_ICLASS.
[ruby-dev:31911]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@16827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -1922,6 +1922,7 @@ id2ref(obj, objid) VALUE obj, objid; { unsigned long ptr, p0; + int type; rb_secure(4); p0 = ptr = NUM2ULONG(objid); @@ -1938,7 +1939,8 @@ id2ref(obj, objid) return ID2SYM(symid); } - if (!is_pointer_to_heap((void *)ptr)|| BUILTIN_TYPE(ptr) >= T_BLKTAG) { + if (!is_pointer_to_heap((void *)ptr)|| + (type = BUILTIN_TYPE(ptr)) >= T_BLKTAG || type == T_ICLASS) { rb_raise(rb_eRangeError, "0x%lx is not id value", p0); } if (BUILTIN_TYPE(ptr) == 0 || RBASIC(ptr)->klass == 0) { |