Project

General

Profile

Actions

Bug #3459

closed

test_regexp.rb Segmentation fault on x64-mswin64

Added by beuniv (shintaro kuwamoto) over 14 years ago. Updated over 13 years ago.

Status:
Closed
Assignee:
-
Target version:
ruby -v:
ruby 1.9.3dev (2010-06-20 trunk 28366) [x64-mswin64_90]
Backport:

Description

=begin
x64-mswin64 trunkのtest_regexp.rbでSegmentation fault します。
根本的な原因は/^()(?>\g<1>)*$/のメモリ確保に失敗するためのようです。
Segfault自体は以下の修正で出なくなります。

Z:\ruby-trunk>svn diff re.c
Index: re.c

--- re.c (リビジョン 28367)
+++ re.c (作業コピー)
@@ -1391,7 +1391,7 @@
else {
onig_errmsg_buffer err = "";
onig_error_code_to_str((UChar*)err, (int)result);

  •       rb_reg_raise(RREGEXP_SRC_PTR(re), RREGEXP_SRC_LEN(re), err, 0);
    
  •       rb_reg_raise(RREGEXP_SRC_PTR(re), RREGEXP_SRC_LEN(re), err, re);
      }
    
    }

修正前のエラーログと、修正後のエラーログです。

Z:\ruby-trunk\build>nmake test-all TESTS=ruby/test_regexp.rb

Microsoft(R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.

     .\ruby.exe -I../lib -I".ext/x64-mswin64_90" "../tool/runruby.rb" --extou

t=".ext" -- "../test/runner.rb" ruby/test_regexp.rb
Loaded suite ../test/runner
Started
...........F..Z:/ruby-trunk/lib/minitest/unit.rb:176: [BUG] Segmentation fault
ruby 1.9.3dev (2010-06-20 trunk 28366) [x64-mswin64_90]

-- control frame ----------
c:0019 p:---- s:0075 b:0075 l:000074 d:000074 CFUNC :=~
c:0018 p:0104 s:0071 b:0070 l:0002a0 d:0002a0 METHOD Z:/ruby-trunk/lib/minitest/
unit.rb:176
c:0017 p:0036 s:0064 b:0064 l:000053 d:000063 BLOCK Z:/ruby-trunk/test/ruby/tes
t_regexp.rb:495
c:0016 p:---- s:0059 b:0059 l:000058 d:000058 FINISH
c:0015 p:---- s:0057 b:0057 l:000056 d:000056 CFUNC :each
c:0014 p:0077 s:0054 b:0054 l:000053 d:000053 METHOD Z:/ruby-trunk/test/ruby/tes
t_regexp.rb:493
c:0013 p:0537 s:0048 b:0048 l:000047 d:000047 METHOD Z:/ruby-trunk/test/ruby/tes
t_regexp.rb:564
c:0012 p:0063 s:0045 b:0045 l:000044 d:000044 METHOD Z:/ruby-trunk/lib/minitest/
unit.rb:680
c:0011 p:0091 s:0039 b:0039 l:000020 d:000038 BLOCK Z:/ruby-trunk/lib/minitest/
unit.rb:641
c:0010 p:---- s:0034 b:0034 l:000033 d:000033 FINISH
c:0009 p:---- s:0032 b:0032 l:000031 d:000031 CFUNC :each
c:0008 p:0026 s:0029 b:0029 l:000020 d:000028 BLOCK Z:/ruby-trunk/lib/minitest/
unit.rb:635
c:0007 p:---- s:0026 b:0026 l:000025 d:000025 FINISH
c:0006 p:---- s:0024 b:0024 l:000023 d:000023 CFUNC :each
c:0005 p:0082 s:0021 b:0021 l:000020 d:000020 METHOD Z:/ruby-trunk/lib/minitest/
unit.rb:634
c:0004 p:0188 s:0016 b:0016 l:000015 d:000015 METHOD Z:/ruby-trunk/lib/minitest/
unit.rb:594
c:0003 p:0041 s:0007 b:0007 l:001f08 d:000006 BLOCK Z:/ruby-trunk/lib/minitest/
unit.rb:492
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001628 d:001628 TOP

-- Ruby level backtrace information ----------------------------------------
Z:/ruby-trunk/lib/minitest/unit.rb:492:in block in autorun' Z:/ruby-trunk/lib/minitest/unit.rb:594:in run'
Z:/ruby-trunk/lib/minitest/unit.rb:634:in run_test_suites' Z:/ruby-trunk/lib/minitest/unit.rb:634:in each'
Z:/ruby-trunk/lib/minitest/unit.rb:635:in block in run_test_suites' Z:/ruby-trunk/lib/minitest/unit.rb:635:in each'
Z:/ruby-trunk/lib/minitest/unit.rb:641:in block (2 levels) in run_test_suites' Z:/ruby-trunk/lib/minitest/unit.rb:680:in run'
Z:/ruby-trunk/test/ruby/test_regexp.rb:564:in test_exec' Z:/ruby-trunk/test/ruby/test_regexp.rb:493:in check'
Z:/ruby-trunk/test/ruby/test_regexp.rb:493:in each' Z:/ruby-trunk/test/ruby/test_regexp.rb:495:in block in check'
Z:/ruby-trunk/lib/minitest/unit.rb:176:in assert_match' Z:/ruby-trunk/lib/minitest/unit.rb:176:in =~'

[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.
NMAKE : fatal error U1077: '.\ruby.exe' : リターン コード '0x3'
Stop.

修正後

Z:\ruby-trunk\build>nmake test-all TESTS=ruby/test_regexp.rb

Microsoft(R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.

     .\ruby.exe -I../lib -I".ext/x64-mswin64_90" "../tool/runruby.rb" --extou

t=".ext" -- "../test/runner.rb" ruby/test_regexp.rb
Loaded suite ../test/runner
Started
...........F..E...................................................
Finished in 3.853200 seconds.

  1. Failure:
    test_dup_warn(TestRegexp) [Z:/ruby-trunk/test/ruby/test_regexp.rb:822]:
    Expected /\A\z/ to match "internal:gem_prelude:45: warning: assigned but unuse
    d variable - paths\ninternal:gem_prelude:162: warning: assigned but unused var
    iable - path\ninternal:gem_prelude:172: warning: assigned but unused variable

66 tests, 999 assertions, 1 failures, 1 errors, 0 skips

Test run options: --seed 24382
NMAKE : fatal error U1077: '.\ruby.exe' : リターン コード '0x1'
Stop.
=end


Related issues 2 (0 open2 closed)

Related to Ruby master - Bug #3742: failed to allocate memory: /^()(?>\g<1>)*$/ on x64-mswin64Closednaruse (Yui NARUSE)08/25/2010Actions
Related to Backport192 - Backport #3743: Segmentation fault on TestRegexp#test_execClosedyugui (Yuki Sonoda)08/25/2010Actions
Actions #1

Updated by beuniv (shintaro kuwamoto) over 14 years ago

=begin
ruby -e"/()/ =~ ''"
でメモリ確保失敗します。
ruby -e"/()
/ =~ ' '"
なら何事もなく通ります。
=end

Actions #2

Updated by naruse (Yui NARUSE) over 14 years ago

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

=begin
This issue was solved with changeset r29074.
shintaro, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0