ruby-changes:48474
From: hsbt <ko1@a...>
Date: Tue, 31 Oct 2017 16:24:34 +0900 (JST)
Subject: [ruby-changes:48474] hsbt:r60588 (trunk): null byte at Psych::Emitter.
hsbt 2017-10-31 16:24:29 +0900 (Tue, 31 Oct 2017) New Revision: 60588 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60588 Log: null byte at Psych::Emitter. Check null byte. Patched by tommy (Masahiro Tomita). [Bug #13993][ruby-dev:50285] Modified files: trunk/ext/psych/psych_emitter.c trunk/ext/psych/psych_yaml_tree.c Index: ext/psych/psych_emitter.c =================================================================== --- ext/psych/psych_emitter.c (revision 60587) +++ ext/psych/psych_emitter.c (revision 60588) @@ -272,8 +272,8 @@ static VALUE scalar( https://github.com/ruby/ruby/blob/trunk/ext/psych/psych_emitter.c#L272 yaml_scalar_event_initialize( &event, - (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValuePtr(anchor)), - (yaml_char_t *)(NIL_P(tag) ? NULL : StringValuePtr(tag)), + (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValueCStr(anchor)), + (yaml_char_t *)(NIL_P(tag) ? NULL : StringValueCStr(tag)), (yaml_char_t*)StringValuePtr(value), (int)RSTRING_LEN(value), plain ? 1 : 0, @@ -319,8 +319,8 @@ static VALUE start_sequence( https://github.com/ruby/ruby/blob/trunk/ext/psych/psych_emitter.c#L319 yaml_sequence_start_event_initialize( &event, - (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValuePtr(anchor)), - (yaml_char_t *)(NIL_P(tag) ? NULL : StringValuePtr(tag)), + (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValueCStr(anchor)), + (yaml_char_t *)(NIL_P(tag) ? NULL : StringValueCStr(tag)), implicit ? 1 : 0, (yaml_sequence_style_t)NUM2INT(style) ); @@ -383,8 +383,8 @@ static VALUE start_mapping( https://github.com/ruby/ruby/blob/trunk/ext/psych/psych_emitter.c#L383 yaml_mapping_start_event_initialize( &event, - (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValuePtr(anchor)), - (yaml_char_t *)(NIL_P(tag) ? NULL : StringValuePtr(tag)), + (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValueCStr(anchor)), + (yaml_char_t *)(NIL_P(tag) ? NULL : StringValueCStr(tag)), implicit ? 1 : 0, (yaml_mapping_style_t)NUM2INT(style) ); @@ -432,7 +432,7 @@ static VALUE alias(VALUE self, VALUE anc https://github.com/ruby/ruby/blob/trunk/ext/psych/psych_emitter.c#L432 yaml_alias_event_initialize( &event, - (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValuePtr(anchor)) + (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValueCStr(anchor)) ); emit(emitter, &event); Index: ext/psych/psych_yaml_tree.c =================================================================== --- ext/psych/psych_yaml_tree.c (revision 60587) +++ ext/psych/psych_yaml_tree.c (revision 60588) @@ -9,7 +9,7 @@ VALUE cPsychVisitorsYamlTree; https://github.com/ruby/ruby/blob/trunk/ext/psych/psych_yaml_tree.c#L9 */ static VALUE private_iv_get(VALUE self, VALUE target, VALUE prop) { - return rb_attr_get(target, rb_intern(StringValuePtr(prop))); + return rb_attr_get(target, rb_intern(StringValueCStr(prop))); } void Init_psych_yaml_tree(void) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/