Bug #5170

Date.strptime Segmentation Fault

Added by Charlie Savage over 2 years ago. Updated over 2 years ago.

[ruby-core:38855]
Status:Closed
Priority:Normal
Assignee:tadayoshi funaba
Category:core
Target version:1.9.3
ruby -v:ruby 1.8.7 (2010-12-23 patchlevel 330) [i386-mingw32] Backport:

Description

require 'date'
Date.strptime('01-31-2011', '%m/%d/%Y')

This happens on Mingw:

ruby 1.9.3dev (2011-07-28 revision 32716) [i386-mingw32]

It also happens on Linux:

ruby 1.9.3dev (2011-07-31 revision 32789) [x86_64-linux]

This is pretty high priority for us because we need to now use Date.strptime since Date.parse no longer handles US style dates correctly.


D:/zerista/app.git/test_dates.rb:3: [BUG] Segmentation fault
ruby 1.9.3dev (2011-07-28 revision 32716) [i386-mingw32]

-- Control frame information -----------------------------------------------
c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC :strptime
c:0003 p:0031 s:0006 b:0006 l:0026d4 d:0016a4 EVAL D:/zerista/app.git/test_dates.rb:3
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:0026d4 d:0026d4 TOP

-- Ruby level backtrace information ----------------------------------------
D:/zerista/app.git/test_dates.rb:3:in <main>'
D:/zerista/app.git/test_dates.rb:3:in
strptime'

-- C level backtrace information -------------------------------------------
C:\Windows\SysWOW64\ntdll.dll(NtWaitForSingleObject+0x15) [0x776bf861]
C:\Windows\syswow64\kernel32.dll(WaitForSingleObjectEx+0x43) [0x76361184]
C:\Windows\syswow64\kernel32.dll(WaitForSingleObject+0x12) [0x76361138]
C:\MinGW\local\ruby193\bin\msvcrt-ruby191.dll(rbvmbugreport+0xef) [0x62e7156f]
C:\MinGW\local\ruby193\bin\msvcrt-ruby191.dll(rbwarning+0x1d0) [0x62d3c570]
C:\MinGW\local\ruby193\bin\msvcrt-ruby191.dll(rb
bug+0x29) [0x62d3c5b9]
C:\MinGW\local\ruby193\bin\msvcrt-ruby191.dll(rbgetnext_signal+0xaf) [0x62dfadcf]
[0x00401262]
C:\Windows\syswow64\kernel32.dll(CheckForReadOnlyResource+0x3bf) [0x76389d77]
C:\Windows\SysWOW64\ntdll.dll(RtlKnownExceptionFilter+0xb7) [0x77710df7]

-- Other runtime information -----------------------------------------------

  • Loaded script: D:/zerista/app.git/test_dates.rb

  • Loaded features:

    0 enumerator.so
    1 C:/MinGW/local/ruby193/lib/ruby/1.9.1/i386-mingw32/enc/encdb.so
    2 C:/MinGW/local/ruby193/lib/ruby/1.9.1/i386-mingw32/enc/iso88591.so
    3 C:/MinGW/local/ruby193/lib/ruby/1.9.1/i386-mingw32/enc/trans/transdb.so
    4 C:/MinGW/local/ruby193/lib/ruby/siteruby/1.9.1/rubygems/defaults.rb
    5 C:/MinGW/local/ruby193/lib/ruby/1.9.1/i386-mingw32/rbconfig.rb
    6 C:/MinGW/local/ruby193/lib/ruby/site
    ruby/1.9.1/rubygems/deprecate.rb
    7 C:/MinGW/local/ruby193/lib/ruby/siteruby/1.9.1/rubygems/exceptions.rb
    8 C:/MinGW/local/ruby193/lib/ruby/site
    ruby/1.9.1/rubygems/customrequire.rb
    9 C:/MinGW/local/ruby193/lib/ruby/site
    ruby/1.9.1/rubygems.rb
    10 C:/Users/cfis/.netbeans/6.9/sync-stdio.rb
    11 C:/MinGW/local/ruby193/lib/ruby/siteruby/1.9.1/ubygems.rb
    12 C:/MinGW/local/ruby193/lib/ruby/1.9.1/i386-mingw32/date
    core.so
    13 C:/MinGW/local/ruby193/lib/ruby/1.9.1/date/format.rb
    14 C:/MinGW/local/ruby193/lib/ruby/1.9.1/date.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.

0001-ext-date-date_core.c-d_new_by_frags-raise-on-non-Has.patch Magnifier (1.46 KB) Eric Wong, 08/09/2011 05:51 AM

History

#1 Updated by Eric Wong over 2 years ago

I can reproduce this on trunk with x86_64, too. The attached patch should fix it.

For git users against trunk (trivial cherry-pick applies to the 1.9.3 branch, too):
git pull git://bogomips.org/ruby date-segfault-bug-5170

#2 Updated by Nobuyoshi Nakada over 2 years ago

  • Assignee set to tadayoshi funaba

DateTime also seems have same issue.

#3 Updated by tadayoshi funaba over 2 years ago

  • Status changed from Open to Closed
  • Priority changed from High to Normal

Also available in: Atom PDF