From: Duncan M. <du...@on...> - 2011-08-01 22:27:22
|
Lion seems to have fundamentally broken RubyCocoa marshalling of binary data for me - viz : DESCRIPTION OF PROBLEM On Lion I cannot create NSData objects from RubyCocoa if any of the bytes have their top bit set. STEPS TO REPRODUCE The following code runs fine on 10.5 and 10.6, but segfaults in Lion (you can just paste it into an irb prompt). require 'osx/cocoa' include OSX byte = 128 bytes = [byte].pack('i_1') NSData.dataWithBytes_length(bytes, bytes.length) 10.6 gives #<OSX::NSConcreteData:0x801bf550 class='NSConcreteData' id=0x1013df110> 10.7 gives /System/Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/oc_wrapper.rb:50: [BUG] Segmentation fault ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0] NOTES AND ATTACHMENTS The code runs fine on 10.5 and 10.6 The code runs fine on 10.7 where byte < 128. The segfault happens on 10.7 if any of the bytes in the bytes string is > 127 The segfault also occurs when using CFDataCreate(0, bytes, bytes.length), NSData.dataWithRubyString, NSData.alloc.init*, NSMutableData.* - in fact, every way that I've tried to create an NSData, leading me to believe that the something very fundamental in the marshalling of strings as binary data is hosed. Has anyone else run into this issue, or am I the only person with who had a live RubyCocoa app? Cheers Duncan McGregor |