From djberg96 at gmail.com Fri Sep 4 10:13:14 2009 From: djberg96 at gmail.com (Daniel Berger) Date: Fri, 4 Sep 2009 07:13:14 -0700 (PDT) Subject: [Pure-devel] Fwd: ruby 1.8.6 p287 and p383 crashing in WIN32OLE_EVENT.message_loop In-Reply-To: References: <246303BB-D4FB-40CA-AC03-2501E3C4F03F@mac.com> <3b923bc5-00f1-4305-b4e1-318d7f3365ab@x25g2000prf.googlegroups.com> Message-ID: <1cb79642-03ec-4e3d-9665-515b4d48c98b@m3g2000pri.googlegroups.com> FYI. I haven't had a chance to look at this yet. Dan ---------- Forwarded message ---------- From: Chuck Remes Date: Sep 2, 4:23?pm Subject: ruby 1.8.6 p287 and p383 crashing in WIN32OLE_EVENT.message_loop To: ruby-talk-google On Sep 2, 2009, at 4:58 PM, Chuck Remes wrote: > On Sep 2, 2009, at 4:43 PM, Daniel Berger wrote: >> >>> It can't seem to load a few of its dependencies like "windows/com". >>> 1. The gem doesn't have a dependency on the windows-api gem. >>> 2. The windows-api gem, after installation, doesn't have a lot of ? >>> the >>> files that pr-win32ole wants to load. >> There is no gem for pr-win32ole. All you should need to do is: >> gem install windows-pr >> That should install win32-api and windows-api automatically. It ? >> should >> then "just work" as long as RUBYOPT is set. If it doesn't, please ? >> give >> me a specific error you're getting. > Well, I ran 'gem build pr-winole32.gemspec' so it was easy to install. > I now have everything up and going. When I run my program, it ? > crashes on a call to WIN32OLE_EVENT.message_loop. > starting... > C:/Ruby/lib/ruby/gems/1.8/gems/pr-win32ole-1.0.0/lib/pr/win32ole.rb: > 701:in `[]=': index 8 out of string (IndexError) > ? ? ? ?from C:/Ruby/lib/ruby/gems/1.8/gems/pr-win32ole-1.0.0/lib/pr/ > win32ole.rb:701:in `ole_val2variant' > ? ? ? ?from C:/Ruby/lib/ruby/gems/1.8/gems/pr-win32ole-1.0.0/lib/pr/ > win32ole.rb:4481 > ? ? ? ?from (eval):3:in `call' > ? ? ? ?from (eval):3:in `DispatchMessage' > ? ? ? ?from C:/Ruby/lib/ruby/gems/1.8/gems/pr-win32ole-1.0.0/lib/pr/ > win32ole.rb:5034:in `ole_msg_loop' > ? ? ? ?from C:/Ruby/lib/ruby/gems/1.8/gems/pr-win32ole-1.0.0/lib/pr/ > win32ole.rb:5039:in `message_loop' > ? ? ? ?from //.host/Shared Folders/My Documents/NetBeansProjects/ > ChuckKit/lib/main.rb:165 > If that trace looks crappy, view it here: ?http://pastie.org/603650 Okay, dug into the pr-win32ole code and this is what I found. Line 701 was trying to access index 8 of a string with only 4 ? characters. Backing up the stack I looked at where it was passed in ? from and see that the +pvarResult+ variable passed into the lambda had ? the value "\n\000". ?The lambda in question is on line 4400. I don't know this code well enough to say where that came from ? originally, but that explains the IndexError anyway. It looks like the ? code that operates on those strings assumes they are 16 characters ? long. That assumption blew it up. cr From djberg96 at gmail.com Sat Sep 12 15:25:50 2009 From: djberg96 at gmail.com (Daniel Berger) Date: Sat, 12 Sep 2009 13:25:50 -0600 Subject: [Pure-devel] Fwd: ruby 1.8.6 p287 and p383 crashing in WIN32OLE_EVENT.message_loop In-Reply-To: References: <246303BB-D4FB-40CA-AC03-2501E3C4F03F@mac.com> <3b923bc5-00f1-4305-b4e1-318d7f3365ab@x25g2000prf.googlegroups.com> <1cb79642-03ec-4e3d-9665-515b4d48c98b@m3g2000pri.googlegroups.com> Message-ID: <012901ca33de$d8059040$8810b0c0$@com> Hi, > I guess the line #4480 and around > > if pvarResult > WIN32OLE.ole_val2variant(result,pvarResult) > end > > should be > > if pvarResult > varResult = 0.chr * 16 > WIN32OLE.ole_val2variant(result,varResult) > memcpy(pvarResult, varResult,16) > end Fixed in trunk. Thanks! Dan