Backport #7516

DL::Function#bind causes SEGV when Fiddle is available

Added by Naohisa Goto over 1 year ago. Updated over 1 year ago.

[ruby-dev:46708]
Status:Closed
Priority:Normal
Assignee:Usaku NAKAMURA

Description

The following script causes SEGV in "f.call(123, 456)" when fiddle is available.
Without Fiddle, it shows correct result.

require 'dl'
require 'dl/func'
include DL
f = Function.new(CFunc.new(0, TYPEINT, 'test'), [TYPEINT, TYPE_INT])
f.bind { |x,y| x + y }
p f.call(123, 456)

Associated revisions

Revision 38502
Added by Usaku NAKAMURA over 1 year ago

merge revision(s) 38211: [Backport #7516]

* ext/dl/lib/dl/func.rb (DL::Function#bind): When Fiddle is used,
  @ptr should be updated. This fixes SEGV raised in DL::Function#call
  after calling DL::Function#bind. [Bug #7516] 

* test/dl/test_func.rb (test_bind): test for the above

History

#1 Updated by Naohisa Goto over 1 year ago

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

This issue was solved with changeset r38211.
Naohisa, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • ext/dl/lib/dl/func.rb (DL::Function#bind): When Fiddle is used, @ptr should be updated. This fixes SEGV raised in DL::Function#call after calling DL::Function#bind. [Bug #7516]
  • test/dl/testfunc.rb (testbind): test for the above

#2 Updated by Naohisa Goto over 1 year ago

  • Tracker changed from Bug to Backport
  • Project changed from ruby-trunk to Backport93
  • Status changed from Closed to Assigned
  • Assignee set to Usaku NAKAMURA

Please backport r38211 which fixes SEGV bug

#3 Updated by Usaku NAKAMURA over 1 year ago

  • Status changed from Assigned to Closed

This issue was solved with changeset r38502.
Naohisa, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


merge revision(s) 38211: [Backport #7516]

* ext/dl/lib/dl/func.rb (DL::Function#bind): When Fiddle is used,
  @ptr should be updated. This fixes SEGV raised in DL::Function#call
  after calling DL::Function#bind. [Bug #7516] 

* test/dl/test_func.rb (test_bind): test for the above

Also available in: Atom PDF