Project

General

Profile

Bug #3108

locationが初期化前に参照されて落ちます。

Added by tarui (Masaya Tarui) almost 10 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Target version:
ruby -v:
ruby 1.9.2dev (2010-04-07 trunk 27249) [i386-mswin32_90]
Backport:
[ruby-dev:40927]

Description

=begin
method情報のlocationが初期化されないまま参照されて落ちる事があります。

C:/usr/lib/ruby/1.9.1/optparse.rb:513: [BUG] rb_gc_mark(): unknown data type 0x1
0(00F1382C) non object
ruby 1.9.2dev (2010-04-07 trunk 27244) [i386-mswin32_90]

-- control frame ----------
c:0010 p:---- s:0033 b:0033 l:000032 d:000032 CFUNC :attr_reader
c:0009 p:0013 s:0029 b:0029 l:000028 d:000028 CLASS C:/usr/lib/ruby/1.9.1/optpa
rse.rb:513
c:0008 p:0312 s:0027 b:0027 l:000026 d:000026 CLASS C:/usr/lib/ruby/1.9.1/optpa
rse.rb:511
c:0007 p:0009 s:0016 b:0016 l:000015 d:000015 TOP C:/usr/lib/ruby/1.9.1/optpa
rse.rb:204
c:0006 p:---- s:0014 b:0014 l:000013 d:000013 FINISH
c:0005 p:---- s:0012 b:0012 l:000011 d:000011 CFUNC :require
c:0004 p:0023 s:0008 b:0008 l:000007 d:000007 TOP C:/usr/lib/ruby/1.9.1/un.rb
:28
c:0003 p:---- s:0006 b:0006 l:000005 d:000005 FINISH
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 CFUNC :require
c:0001 p:0000 s:0002 b:0002 l:000dc4 d:000dc4 TOP


-- Ruby level backtrace information ----------------------------------------
C:\usr\bin\ruby:0:in require'
C:/usr/lib/ruby/1.9.1/un.rb:28:in
'
C:/usr/lib/ruby/1.9.1/un.rb:28:in require'
C:/usr/lib/ruby/1.9.1/optparse.rb:204:in
'
C:/usr/lib/ruby/1.9.1/optparse.rb:511:in <class:OptionParser>'
C:/usr/lib/ruby/1.9.1/optparse.rb:513:in
class:List'
C:/usr/lib/ruby/1.9.1/optparse.rb:513:in `attr_reader'

原因はvm_method.c:286でlocationに値を入れる前にrb_ary_new3経由でGCが呼ばれる事があるためです。

Patchは多分こんなものでしょうか。

svn diff
Index: vm_method.c
===================================================================
--- vm_method.c (リビジョン 27249)
+++ vm_method.c (作業コピー)
@@ -280,6 +280,7 @@
case VM_METHOD_TYPE_ATTRSET:
case VM_METHOD_TYPE_IVAR:
def->body.attr.id = (ID)opts;

  • def->body.attr.location = Qfalse; th = GET_THREAD(); cfp = rb_vm_get_ruby_level_next_cfp(th, th->cfp); if (cfp && (line = rb_vm_get_sourceline(cfp))) { =end

Associated revisions

Revision 7d73136d
Added by wanabe (_ wanabe) almost 10 years ago

  • vm_method.c (rb_add_method): clear attr.location before rb_ary_new3. a patch from Masaya TARUI in [Bug #3108]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 27281
Added by wanabe (_ wanabe) almost 10 years ago

  • vm_method.c (rb_add_method): clear attr.location before rb_ary_new3. a patch from Masaya TARUI in [Bug #3108]

Revision 27281
Added by wanabe (_ wanabe) almost 10 years ago

  • vm_method.c (rb_add_method): clear attr.location before rb_ary_new3. a patch from Masaya TARUI in [Bug #3108]

Revision 27281
Added by wanabe (_ wanabe) almost 10 years ago

  • vm_method.c (rb_add_method): clear attr.location before rb_ary_new3. a patch from Masaya TARUI in [Bug #3108]

Revision 27281
Added by wanabe (_ wanabe) almost 10 years ago

  • vm_method.c (rb_add_method): clear attr.location before rb_ary_new3. a patch from Masaya TARUI in [Bug #3108]

Revision 27281
Added by wanabe (_ wanabe) almost 10 years ago

  • vm_method.c (rb_add_method): clear attr.location before rb_ary_new3. a patch from Masaya TARUI in [Bug #3108]

Revision 27281
Added by wanabe (_ wanabe) almost 10 years ago

  • vm_method.c (rb_add_method): clear attr.location before rb_ary_new3. a patch from Masaya TARUI in [Bug #3108]

History

#1

Updated by wanabe (_ wanabe) almost 10 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r27281.
masaya, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Also available in: Atom PDF