* ext/syck/rubyext.c (syck_emitter_reset): should initialize

emitter->bonus->oid. otherwise rb_gc_mark crashes.

* ext/syck/rubyext.c (syck_mark_parser): should mark anchor nodes
  because they hold ruby objects. (ie: rb_syck_bad_anchor_handler)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ocean 2005-12-17 12:57:05 +00:00
Родитель 74a077aaba
Коммит 8ed2a927e8
2 изменённых файлов: 25 добавлений и 2 удалений

Просмотреть файл

@ -1,3 +1,11 @@
Sat Dec 17 21:50:41 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
* ext/syck/rubyext.c (syck_emitter_reset): should initialize
emitter->bonus->oid. otherwise rb_gc_mark crashes.
* ext/syck/rubyext.c (syck_mark_parser): should mark anchor nodes
because they hold ruby objects. (ie: rb_syck_bad_anchor_handler)
Sat Dec 17 03:57:01 2005 Tanaka Akira <akr@m17n.org>
* bignum.c (rb_big_rshift): fix a GC problem on

Просмотреть файл

@ -617,8 +617,7 @@ rb_syck_load_handler(p, n)
/*
* Create node,
*/
obj = rb_funcall( resolver, s_node_import,
1, Data_Wrap_Struct( cNode, syck_node_mark, NULL, n ) );
obj = rb_funcall( resolver, s_node_import, 1, Data_Wrap_Struct( cNode, NULL, NULL, n ) );
/*
* ID already set, let's alter the symbol table to accept the new object
@ -706,6 +705,13 @@ syck_set_model( p, input, model )
syck_parser_bad_anchor_handler( parser, rb_syck_bad_anchor_handler );
}
static int
syck_st_mark_nodes( char *key, SyckNode *n, char *arg )
{
if ( n != (void *)1 ) syck_node_mark( n );
return ST_CONTINUE;
}
/*
* mark parser nodes
*/
@ -723,6 +729,14 @@ syck_mark_parser(parser)
rb_gc_mark( bonus->proc );
rb_gc_mark( bonus->resolver );
}
if ( parser->anchors != NULL )
{
st_foreach( parser->anchors, syck_st_mark_nodes, 0 );
}
if ( parser->bad_anchors != NULL )
{
st_foreach( parser->bad_anchors, syck_st_mark_nodes, 0 );
}
}
/*
@ -2013,6 +2027,7 @@ syck_emitter_reset( argc, argv, self )
if ( bonus != NULL ) S_FREE( bonus );
bonus = S_ALLOC_N( struct emitter_xtra, 1 );
bonus->oid = Qnil;
bonus->port = rb_str_new2( "" );
bonus->data = hash = rb_hash_new();