Subject:
[ruby-ffi] Is this a bug?
From:
David
Date:
3/17/11 9:57 PM
To:
ruby-ffi

I was going through the group messages and found what I was looking
for but it doesn't seem to work anymore.

ppdev = FFI::MemoryPointer.new :pointer
errbuf = FFI::MemoryPointer.new :char, Pcap::PCAP_ERRBUF_SIZE
res = Pcap.pcap_findalldevs(ppdev, errbuf)

http://groups.google.com/group/ruby-ffi/browse_thread/thread/26de1897ec0597a5

This code raises invalid string parameter and when passing in an empty
string instead of errbuf the JVM crashes because various registers are
holding invalid pointer addresses.

The problem exists in both Jruby 1.6(using ruby 1.9.2) and MRI 1.9.2.