Project

General

Profile

Bug #10885

Segmentation fault when calling refined method in duplicate module

Added by ktsj (Kazuki Tsujimoto) over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.0dev (2015-02-22) [x86_64-linux]
[ruby-dev:48878]

Description

以下のコードでSEGVします。
Moduleをdupする時にcrefをコピーしていますが、その中でnd_refinementsを設定していないのが原因です。

module M
  refine BasicObject do
    def __id__
    end
  end

  class << self
    def m
      __id__
    end
  end
end

M.dup.m

Associated revisions

Revision e660f776
Added by ktsj (Kazuki Tsujimoto) over 4 years ago

  • vm_insnhelper.c (rb_vm_rewrite_cref_stack): copy nd_refinements
    of orignal crefs. It fixes segmentation fault when calling
    refined method in duplicate module. [ruby-dev:48878] [Bug #10885]

  • vm_core.h, class.c: change accordingly.

  • test/ruby/test_refinement.rb: add a test for above.

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

Revision 49685
Added by ktsj (Kazuki Tsujimoto) over 4 years ago

  • vm_insnhelper.c (rb_vm_rewrite_cref_stack): copy nd_refinements
    of orignal crefs. It fixes segmentation fault when calling
    refined method in duplicate module. [ruby-dev:48878] [Bug #10885]

  • vm_core.h, class.c: change accordingly.

  • test/ruby/test_refinement.rb: add a test for above.

Revision 49685
Added by ktsj (Kazuki Tsujimoto) over 4 years ago

  • vm_insnhelper.c (rb_vm_rewrite_cref_stack): copy nd_refinements
    of orignal crefs. It fixes segmentation fault when calling
    refined method in duplicate module. [ruby-dev:48878] [Bug #10885]

  • vm_core.h, class.c: change accordingly.

  • test/ruby/test_refinement.rb: add a test for above.

Revision 49685
Added by ktsj (Kazuki Tsujimoto) over 4 years ago

  • vm_insnhelper.c (rb_vm_rewrite_cref_stack): copy nd_refinements
    of orignal crefs. It fixes segmentation fault when calling
    refined method in duplicate module. [ruby-dev:48878] [Bug #10885]

  • vm_core.h, class.c: change accordingly.

  • test/ruby/test_refinement.rb: add a test for above.

Revision 49685
Added by ktsj (Kazuki Tsujimoto) over 4 years ago

  • vm_insnhelper.c (rb_vm_rewrite_cref_stack): copy nd_refinements
    of orignal crefs. It fixes segmentation fault when calling
    refined method in duplicate module. [ruby-dev:48878] [Bug #10885]

  • vm_core.h, class.c: change accordingly.

  • test/ruby/test_refinement.rb: add a test for above.

Revision 49685
Added by ktsj (Kazuki Tsujimoto) over 4 years ago

  • vm_insnhelper.c (rb_vm_rewrite_cref_stack): copy nd_refinements
    of orignal crefs. It fixes segmentation fault when calling
    refined method in duplicate module. [ruby-dev:48878] [Bug #10885]

  • vm_core.h, class.c: change accordingly.

  • test/ruby/test_refinement.rb: add a test for above.

Revision 6cbbe854
Added by naruse (Yui NARUSE) over 4 years ago

merge revision(s) 49685,49687: [Backport #10885]

    * vm_insnhelper.c (rb_vm_rewrite_cref_stack): copy nd_refinements
      of orignal crefs. It fixes segmentation fault when calling
      refined method in duplicate module. [ruby-dev:48878] [Bug #10885]

    * vm_core.h, class.c: change accordingly.

    * test/ruby/test_refinement.rb: add a test for above.
      of original crefs. It fixes segmentation fault when calling

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

Revision 49708
Added by naruse (Yui NARUSE) over 4 years ago

merge revision(s) 49685,49687: [Backport #10885]

* vm_insnhelper.c (rb_vm_rewrite_cref_stack): copy nd_refinements
  of orignal crefs. It fixes segmentation fault when calling
  refined method in duplicate module. [ruby-dev:48878] [Bug #10885]

* vm_core.h, class.c: change accordingly.

* test/ruby/test_refinement.rb: add a test for above.
  of original crefs. It fixes segmentation fault when calling

Revision 852d56ff
Added by usa (Usaku NAKAMURA) over 4 years ago

merge revision(s) 49685,49687: [Backport #10885]

    * vm_insnhelper.c (rb_vm_rewrite_cref_stack): copy nd_refinements
      of orignal crefs. It fixes segmentation fault when calling
      refined method in duplicate module. [ruby-dev:48878] [Bug #10885]

    * vm_core.h, class.c: change accordingly.

    * test/ruby/test_refinement.rb: add a test for above.
      of original crefs. It fixes segmentation fault when calling

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

Revision 49739
Added by usa (Usaku NAKAMURA) over 4 years ago

merge revision(s) 49685,49687: [Backport #10885]

* vm_insnhelper.c (rb_vm_rewrite_cref_stack): copy nd_refinements
  of orignal crefs. It fixes segmentation fault when calling
  refined method in duplicate module. [ruby-dev:48878] [Bug #10885]

* vm_core.h, class.c: change accordingly.

* test/ruby/test_refinement.rb: add a test for above.
  of original crefs. It fixes segmentation fault when calling

Revision 58528733
Added by nagachika (Tomoyuki Chikanaga) over 4 years ago

merge revision(s) r49685,r49687: [Backport #10885]

    * vm_insnhelper.c (rb_vm_rewrite_cref_stack): copy nd_refinements
      of orignal crefs. It fixes segmentation fault when calling
      refined method in duplicate module. [ruby-dev:48878] [Bug #10885]

    * vm_core.h, class.c: change accordingly.

    * test/ruby/test_refinement.rb: add a test for above.
      of original crefs. It fixes segmentation fault when calling

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

Revision 49995
Added by nagachika (Tomoyuki Chikanaga) over 4 years ago

merge revision(s) r49685,r49687: [Backport #10885]

* vm_insnhelper.c (rb_vm_rewrite_cref_stack): copy nd_refinements
  of orignal crefs. It fixes segmentation fault when calling
  refined method in duplicate module. [ruby-dev:48878] [Bug #10885]

* vm_core.h, class.c: change accordingly.

* test/ruby/test_refinement.rb: add a test for above.
  of original crefs. It fixes segmentation fault when calling

History

#1

Updated by ktsj (Kazuki Tsujimoto) over 4 years ago

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

Applied in changeset r49685.


  • vm_insnhelper.c (rb_vm_rewrite_cref_stack): copy nd_refinements
    of orignal crefs. It fixes segmentation fault when calling
    refined method in duplicate module. [ruby-dev:48878] [Bug #10885]

  • vm_core.h, class.c: change accordingly.

  • test/ruby/test_refinement.rb: add a test for above.

Updated by naruse (Yui NARUSE) over 4 years ago

  • Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED to 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: DONE

ruby_2_2 r49708 merged revision(s) 49685,49687.

Updated by usa (Usaku NAKAMURA) over 4 years ago

  • Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: DONE to 2.0.0: DONE, 2.1: REQUIRED, 2.2: DONE

ruby_2_0_0 r49739 merged revision(s) 49685,49687.
note: omitted the test because Module#using is not available on 2.0.0.

#4

Updated by nagachika (Tomoyuki Chikanaga) over 4 years ago

  • Backport changed from 2.0.0: DONE, 2.1: REQUIRED, 2.2: DONE to 2.0.0: DONE, 2.1: DONE, 2.2: DONE

Backported into ruby_2_1 branch at r49995.

Also available in: Atom PDF