Project

General

Profile

Bug #8692

segv in fiddle

Added by Zachary Scott almost 3 years ago. Updated almost 3 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
ruby -v:
ruby 2.1.0dev (2013-07-26 trunk 42177) [x86_64-darwin12.4.0]
[ruby-core:56187]

Description

=begin
require 'fiddle'
libc = Fiddle.dlopen('libc.dylib')
time = Fiddle::Function.new( libc['time'], [Fiddle::TYPE_VOIDP], Fiddle::TYPE_VOIDP )
puts time.call(nil)

stack trace: ((URL:https://gist.github.com/zzak/6085700))
=end

History

#1 [ruby-core:56188] Updated by Zachary Scott almost 3 years ago

  • Description updated (diff)

#2 [ruby-core:56189] Updated by Nobuyoshi Nakada almost 3 years ago

  • Description updated (diff)

#3 [ruby-core:56192] Updated by Nobuyoshi Nakada almost 3 years ago

  • Status changed from Open to Rejected

=begin
(({time()})) returns (({time_t})), not pointer.
As Fiddle doesn't provide (({TYPE_TIME_T})) currently, you have to use (({TYPE_LONG})) instead.

require 'fiddle'
libc = Fiddle.dlopen(nil)
time = Fiddle::Function.new(libc['time'], [Fiddle::TYPE_VOIDP], Fiddle::TYPE_LONG)
puts time.call(nil)
=end

Also available in: Atom PDF