summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-05 03:22:03 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-05 03:22:03 +0000
commit545ebecb30dce3fbb63c319a553c78cfb44a20a1 (patch)
treee37d13a3064f575eebf640971bed5402f4873aa0 /gc.c
parentdfbf5ccae692c036c1ec5a513983eb339bd7dc5d (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_5@16825 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 ef3044c1a3..2e171bd9d7 100644
--- a/gc.c
+++ b/gc.c
@@ -1878,6 +1878,7 @@ id2ref(obj, objid)
VALUE obj, objid;
{
unsigned long ptr, p0;
+ int type;
rb_secure(4);
p0 = ptr = NUM2ULONG(objid);
@@ -1894,7 +1895,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) {