1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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@13587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2007-10-01 13:45:06 +00:00
parent ac7497416d
commit 02914c8a16
2 changed files with 8 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Mon Oct 1 12:50:59 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* gc.c (id2ref): valid id should not refer T_VALUE nor T_ICLASS.
[ruby-dev:31911]
Wed Sep 26 23:54:37 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/extmk.rb (extmake), lib/mkmf.rb (configuration): top_srcdir

4
gc.c
View file

@ -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) {