Bug #3668


make check segfault in test_syntax.rb

Added by luislavena (Luis Lavena) almost 13 years ago. Updated about 12 years ago.

Target version:
ruby -v:
ruby 1.8.7 (2010-06-23 patchlevel 299) [i386-mingw32]


While build Ruby 1.9.3dev (trunk) under MinGW (GCC 4.5.0) and running tests, it segfault with the following traceback:

C:/Users/Luis/Projects/oss/ruby/test/ruby/test_syntax.rb:18: [BUG] Segmentation fault
ruby 1.9.3dev (2010-08-08 trunk 28909) [i386-mingw32]

-- control frame ----------
c:0020 p:---- s:0082 b:0082 l:000081 d:000081 CFUNC :read
c:0019 p:0026 s:0078 b:0076 l:000054 d:000075 BLOCK C:/Users/Luis/Projects/oss/ruby/test/ruby/test_syntax.rb:18
c:0018 p:---- s:0073 b:0073 l:000072 d:000072 FINISH
c:0017 p:---- s:0071 b:0071 l:000070 d:000070 CFUNC :each
c:0016 p:0040 s:0068 b:0068 l:000054 d:000067 BLOCK C:/Users/Luis/Projects/oss/ruby/test/ruby/test_syntax.rb:17
c:0015 p:0080 s:0065 b:0065 l:000064 d:000064 METHOD C:/Users/Luis/Projects/oss/ruby/lib/test/unit/assertions.rb:34
c:0014 p:0018 s:0055 b:0055 l:000054 d:000054 METHOD C:/Users/Luis/Projects/oss/ruby/test/ruby/test_syntax.rb:16
c:0013 p:0063 s:0052 b:0052 l:000051 d:000051 METHOD C:/Users/Luis/Projects/oss/ruby/lib/minitest/unit.rb:680
c:0012 p:0091 s:0046 b:0046 l:00032c d:000045 BLOCK C:/Users/Luis/Projects/oss/ruby/lib/minitest/unit.rb:641
c:0011 p:---- s:0041 b:0041 l:000040 d:000040 FINISH
c:0010 p:---- s:0039 b:0039 l:000038 d:000038 CFUNC :each
c:0009 p:0026 s:0036 b:0036 l:00032c d:000035 BLOCK C:/Users/Luis/Projects/oss/ruby/lib/minitest/unit.rb:635
c:0008 p:---- s:0033 b:0033 l:000032 d:000032 FINISH
c:0007 p:---- s:0031 b:0031 l:000030 d:000030 CFUNC :each
c:0006 p:0082 s:0028 b:0028 l:00032c d:00032c METHOD C:/Users/Luis/Projects/oss/ruby/lib/minitest/unit.rb:634
c:0005 p:0188 s:0023 b:0023 l:002464 d:002464 METHOD C:/Users/Luis/Projects/oss/ruby/lib/minitest/unit.rb:594
c:0004 p:0022 s:0014 b:0014 l:001b48 d:001b48 METHOD C:/Users/Luis/Projects/oss/ruby/lib/test/unit.rb:21
c:0003 p:0136 s:0010 b:0009 l:001dac d:0003b0 EVAL ../../../../ruby/test/runner.rb:26
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001dac d:001dac TOP

-- Ruby level backtrace information ----------------------------------------
../../../../ruby/test/runner.rb:26:in <main>' C:/Users/Luis/Projects/oss/ruby/lib/test/unit.rb:21:in run'
C:/Users/Luis/Projects/oss/ruby/lib/minitest/unit.rb:594:in run' C:/Users/Luis/Projects/oss/ruby/lib/minitest/unit.rb:634:in run_test_suites'
C:/Users/Luis/Projects/oss/ruby/lib/minitest/unit.rb:634:in each' C:/Users/Luis/Projects/oss/ruby/lib/minitest/unit.rb:635:in block in run_test_suites'
C:/Users/Luis/Projects/oss/ruby/lib/minitest/unit.rb:635:in each' C:/Users/Luis/Projects/oss/ruby/lib/minitest/unit.rb:641:in block (2 levels) in run_test_suites'
C:/Users/Luis/Projects/oss/ruby/lib/minitest/unit.rb:680:in run' C:/Users/Luis/Projects/oss/ruby/test/ruby/test_syntax.rb:16:in test_syntax'
C:/Users/Luis/Projects/oss/ruby/lib/test/unit/assertions.rb:34:in assert_nothing_raised' C:/Users/Luis/Projects/oss/ruby/test/ruby/test_syntax.rb:17:in block in test_syntax'
C:/Users/Luis/Projects/oss/ruby/test/ruby/test_syntax.rb:17:in each' C:/Users/Luis/Projects/oss/ruby/test/ruby/test_syntax.rb:18:in block (2 levels) in test_syntax'
C:/Users/Luis/Projects/oss/ruby/test/ruby/test_syntax.rb:18:in `read'

Individual execution of the tests did not segfault, indicating that something executed before could have triggered it.

An error of a missing temporary extension and fail to load it was triggered as popup. Will try to execute tests again and see if can note the tests triggered the previous issue.

Thank you.


i386-mingw32.txt (2.93 KB) i386-mingw32.txt crash dump pweldon (Peter Weldon), 08/15/2010 04:26 AM
i386-mswin32_100.txt (5.46 KB) i386-mswin32_100.txt call stack on heap corruption pweldon (Peter Weldon), 08/15/2010 04:26 AM
string.c.bug3668.patch (917 Bytes) string.c.bug3668.patch string.c (str_make_independent): set capacity of expanded string correctly pweldon (Peter Weldon), 08/17/2010 06:29 AM

Updated by pweldon (Peter Weldon) almost 13 years ago

Appears to be triggered by heap corruption during test/ruby/test_string.rb. Likewise with [ruby 1.9.3dev (2010-08-15) [i386-mswin32_100]], heap corruption is detected when linked to the debug crt libs.


Actions #2

Updated by usa (Usaku NAKAMURA) almost 13 years ago

  • Status changed from Open to Assigned
  • Assignee set to nobu (Nobuyoshi Nakada)



Actions #3

Updated by pweldon (Peter Weldon) almost 13 years ago

Seems to be a buffer overrun caused by changes in string.c (str_make_independent_expand) at r28863.

Patch attached.

Before patch:

ruby.exe --version
ruby 1.9.3dev (2010-08-16) [i386-mswin32_100]

ruby test\ruby\test_string.rb
Loaded suite test/ruby/test_string
HEAP CORRUPTION DETECTED: after Normal block (#53951) at 0x022D5088.
CRT detected that the application wrote to memory after end of heap buffer.
Finished in 0.540031 seconds.

116 tests, 1771 assertions, 0 failures, 0 errors, 0 skips

Test run options: --seed 54485


Actions #4

Updated by nobu (Nobuyoshi Nakada) almost 13 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r29018.
Luis, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.



Also available in: Atom PDF