Skip to content

Instantly share code, notes, and snippets.

@aogail
Created August 27, 2012 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aogail/3492796 to your computer and use it in GitHub Desktop.
Save aogail/3492796 to your computer and use it in GitHub Desktop.
Segmentation fault caused by no-args EventLog clear()
require 'rubygems'
gem 'win32-eventlog'
require 'win32/eventlog'
el = Win32::EventLog.new('HardwareEvents')
el.clear()
(eval):3: [BUG] Segmentation fault
ruby 1.9.3p194 (2012-04-20) [i386-mingw32]
-- Control frame information -----------------------------------------------
c:0006 p:---- s:0022 b:0022 l:000021 d:000021 CFUNC :call
c:0005 p:0021 s:0017 b:0017 l:000016 d:000016 METHOD (eval):3
c:0004 p:0067 s:0012 b:0012 l:000011 d:000011 METHOD C:/Ruby193/lib/ruby/gems/1.9.1/gems/win32-eventlog-0.5.3/lib/win32/
eventlog.rb:425
c:0003 p:0069 s:0007 b:0007 l:000c5c d:001f18 EVAL clear_hw_events.rb:6
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:000c5c d:000c5c TOP
-- Ruby level backtrace information ----------------------------------------
clear_hw_events.rb:6:in `<main>'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/win32-eventlog-0.5.3/lib/win32/eventlog.rb:425:in `clear'
(eval):3:in `ClearEventLog'
(eval):3:in `call'
-- C level backtrace information -------------------------------------------
C:\Windows\SYSTEM32\ntdll.dll(KiFastSystemCallRet+0x0) [0x76e37094]
C:\Windows\system32\kernel32.dll(WaitForSingleObjectEx+0x43) [0x752cc2f3]
C:\Windows\system32\kernel32.dll(WaitForSingleObject+0x12) [0x752cc2a2]
C:\Ruby193\bin\msvcrt-ruby191.dll(rb_vm_bugreport+0xf9) [0x62e5c589]
C:\Ruby193\bin\msvcrt-ruby191.dll(rb_name_err_mesg_new+0x17a) [0x62d3a7e2]
C:\Ruby193\bin\msvcrt-ruby191.dll(rb_bug+0x2f) [0x62d3b4fb]
C:\Ruby193\bin\msvcrt-ruby191.dll(rb_check_safe_str+0x1a4) [0x62dee168]
[0x004011e6]
C:\Windows\system32\kernel32.dll(UnhandledExceptionFilter+0xf5) [0x752e0746]
C:\Windows\SYSTEM32\ntdll.dll(EtwReplyNotification+0x366) [0x76e67f02]
-- Other runtime information -----------------------------------------------
* Loaded script: clear_hw_events.rb
* Loaded features:
0 enumerator.so
1 C:/Ruby193/lib/ruby/1.9.1/i386-mingw32/enc/encdb.so
2 C:/Ruby193/lib/ruby/1.9.1/i386-mingw32/enc/iso_8859_1.so
3 C:/Ruby193/lib/ruby/1.9.1/i386-mingw32/enc/trans/transdb.so
4 C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/defaults.rb
5 C:/Ruby193/lib/ruby/1.9.1/i386-mingw32/rbconfig.rb
6 C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/deprecate.rb
7 C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/exceptions.rb
8 C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/defaults/operating_system.rb
9 C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb
10 C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems.rb
11 C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/version.rb
12 C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/requirement.rb
13 C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb
14 C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/platform.rb
15 C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb
16 C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/path_support.rb
17 C:/Ruby193/lib/ruby/1.9.1/i386-mingw32/enc/utf_16le.so
18 C:/Ruby193/lib/ruby/1.9.1/i386-mingw32/enc/trans/utf_16_32.so
19 C:/Ruby193/lib/ruby/1.9.1/i386-mingw32/enc/trans/single_byte.so
20 C:/Ruby193/lib/ruby/gems/1.9.1/gems/win32-api-1.4.8-x86-mingw32/lib/win32/ruby19/win32/api.so
21 C:/Ruby193/lib/ruby/gems/1.9.1/gems/win32-api-1.4.8-x86-mingw32/lib/win32/api.rb
22 C:/Ruby193/lib/ruby/1.9.1/forwardable.rb
23 C:/Ruby193/lib/ruby/gems/1.9.1/gems/windows-api-0.4.2/lib/windows/api.rb
24 C:/Ruby193/lib/ruby/gems/1.9.1/gems/windows-pr-1.2.2/lib/windows/error.rb
25 C:/Ruby193/lib/ruby/gems/1.9.1/gems/windows-pr-1.2.2/lib/windows/eventlog.rb
26 C:/Ruby193/lib/ruby/gems/1.9.1/gems/windows-pr-1.2.2/lib/windows/security.rb
27 C:/Ruby193/lib/ruby/gems/1.9.1/gems/windows-pr-1.2.2/lib/windows/msvcrt/string.rb
28 C:/Ruby193/lib/ruby/gems/1.9.1/gems/windows-pr-1.2.2/lib/windows/unicode.rb
29 C:/Ruby193/lib/ruby/gems/1.9.1/gems/windows-pr-1.2.2/lib/windows/file.rb
30 C:/Ruby193/lib/ruby/gems/1.9.1/gems/windows-pr-1.2.2/lib/windows/registry.rb
31 C:/Ruby193/lib/ruby/gems/1.9.1/gems/windows-pr-1.2.2/lib/windows/system_info.rb
32 C:/Ruby193/lib/ruby/gems/1.9.1/gems/windows-pr-1.2.2/lib/windows/library.rb
33 C:/Ruby193/lib/ruby/gems/1.9.1/gems/windows-pr-1.2.2/lib/windows/synchronize.rb
34 C:/Ruby193/lib/ruby/gems/1.9.1/gems/windows-pr-1.2.2/lib/windows/handle.rb
35 C:/Ruby193/lib/ruby/gems/1.9.1/gems/win32-eventlog-0.5.3/lib/win32/eventlog.rb
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
@djberg96
Copy link

I'll bet this is because I changed the prototype for the ClearEventLog function. If you pass an empty string I'll bet it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment