summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gc.c b/gc.c
index 1024c1a50e..613ad6db1e 100644
--- a/gc.c
+++ b/gc.c
@@ -1636,10 +1636,10 @@ id2ref(obj, id)
}
ptr = id ^ FIXNUM_FLAG; /* unset FIXNUM_FLAG */
- if (!is_pointer_to_heap((void *)ptr)) {
+ if (!is_pointer_to_heap((void *)ptr)|| BUILTIN_TYPE(ptr) >= T_BLKTAG) {
rb_raise(rb_eRangeError, "0x%lx is not id value", p0);
}
- if (RBASIC(ptr)->klass == 0) {
+ if (BUILTIN_TYPE(ptr) == 0 || RBASIC(ptr)->klass == 0) {
rb_raise(rb_eRangeError, "0x%lx is recycled object", p0);
}
return (VALUE)ptr;