Bug #3108
closedlocationが初期化前に参照されて落ちます。
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
<top (required)>'
C:/usr/lib/ruby/1.9.1/un.rb:28:in require' C:/usr/lib/ruby/1.9.1/optparse.rb:204:in
<top (required)>'
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
Updated by wanabe (_ wanabe) over 14 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