summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-05 03:23:32 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-05 03:23:32 +0000
commiteca461acaaae50394a9583481663baf6e3b103ae (patch)
treec72f106201987fb5a26b3c36b60dc995e5ae1b9f /gc.c
parent1ecb29fbf81f9fee8e599c51b071d4e4ae558fc1 (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.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gc.c b/gc.c
index 052df8f..4298a8a 100644
--- a/gc.c
+++ b/gc.c
@@ -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) {