Issue #10392 has been updated by Tomoyuki C…
Backport changed from 2.0.0: DONE, 2.1: REQUIRED to 2.0.0: DONE, 2.1:
DONE
Backported into ruby_2_1
at r48003.
Bug #10392: Ripper.sexp(“<<‘E’\n E\n\n”)
- Author: Akira T.
- Status: Closed
- Priority: Normal
- Assignee:
- Category:
- Target version:
- ruby -v: ruby 2.2.0dev (2014-10-16 trunk 47971) [x86_64-linux]
- Backport: 2.0.0: DONE, 2.1: DONE
以下のようにすると SEGV になります。
% cat z.rb
require 'ripper'
Ripper.sexp("<<'E'\n E\n\n")
% ./ruby z.rb
/home/ruby/tst1/lib/ruby/2.2.0/ripper/sexp.rb:31: [BUG] Segmentation
fault at 0x00000000000008
ruby 2.2.0dev (2014-10-16 trunk 47971) [x86_64-linux]
-- Control frame information
-----------------------------------------------
c:0004 p:---- s:0013 e:000012 CFUNC :parse
c:0003 p:0028 s:0010 e:000009 METHOD
/home/ruby/tst1/lib/ruby/2.2.0/ripper/sexp.rb:31
c:0002 p:0021 s:0004 E:000190 EVAL z.rb:2 [FINISH]
c:0001 p:0000 s:0002 E:001920 TOP [FINISH]
-- Ruby level backtrace information
----------------------------------------
z.rb:2:in `<main>'
/home/ruby/tst1/lib/ruby/2.2.0/ripper/sexp.rb:31:in `sexp'
/home/ruby/tst1/lib/ruby/2.2.0/ripper/sexp.rb:31:in `parse'
-- Machine register context
------------------------------------------------
RIP: 0x00007fc0402e08ca RBP: 0x00007fffbe5f1a20 RSP: 0x00007fffbe5f19f0
RAX: 0x0000000000000000 RBX: 0x0000000000000097 RCX: 0x0000000000000097
RDX: 0x00007fffbe5f1a40 RDI: 0x00007fc042a98ae0 RSI: 0x0000000000000097
R8: 0x00007fc042a3fc50 R9: 0x0000000000000003 R10: 0x00007fffbe5f1ac0
R11: 0x00007fc0402eaa06 R12: 0x00007fc040215860 R13: 0x00007fffbe5f3d50
R14: 0x00007fc042a9ab70 R15: 0x00007fc03f04bf20 EFL: 0x0000000000010206
-- C level backtrace information
-------------------------------------------
/home/ruby/tst1/ruby/ruby(rb_print_backtrace+0x19) [0x7fc04034c0f1]
vm_dump.c:694
/home/ruby/tst1/ruby/ruby(rb_vm_bugreport+0xa9) [0x7fc04034c566]
vm_dump.c:972
/home/ruby/tst1/ruby/ruby(rb_bug_context+0x113) [0x7fc0403a90b3]
error.c:391
/home/ruby/tst1/ruby/ruby(sigsegv+0x8d) [0x7fc0402d61f8] signal.c:851
/lib/x86_64-linux-gnu/libpthread.so.0 [0x7fc03fdc38d0]
/home/ruby/tst1/ruby/ruby(st_lookup+0x1b) [0x7fc0402e08ca] st.c:386
/home/ruby/tst1/ruby/ruby(lookup_method_table+0x4a) [0x7fc04033cb16]
vm_method.c:209
/home/ruby/tst1/ruby/ruby(search_method+0x31) [0x7fc04033d86e]
vm_method.c:566
/home/ruby/tst1/ruby/ruby(rb_method_entry_get_without_cache+0x2b)
[0x7fc04033d8fa] vm_method.c:591
/home/ruby/tst1/ruby/ruby(rb_method_entry+0xb8) [0x7fc04033dae2]
vm_method.c:662
/home/ruby/tst1/ruby/ruby(check_funcall_respond_to+0x2d)
[0x7fc0403407fa] vm_eval.c:369
/home/ruby/tst1/ruby/ruby(rb_check_funcall+0x48) [0x7fc040340a13]
vm_eval.c:426
/home/ruby/tst1/ruby/ruby(convert_type+0xcc) [0x7fc04027ae48]
object.c:2611
/home/ruby/tst1/ruby/ruby(rb_convert_type+0x47) [0x7fc04027afe8]
object.c:2647
/home/ruby/tst1/ruby/ruby(rb_str_to_str+0x2b) [0x7fc0402e61f1]
string.c:1057
/home/ruby/tst1/ruby/ruby(rb_string_value+0x4b) [0x7fc0402e827a]
string.c:1657
/home/ruby/tst1/ruby/ruby(rb_str_append+0x1c) [0x7fc0402eaa22]
string.c:2340
/home/ruby/tst1/lib/ruby/2.2.0/x86_64-linux/ripper.so(parser_here_document+0x197)
[0x7fc03e72620b] ripper.y:6540
/home/ruby/tst1/lib/ruby/2.2.0/x86_64-linux/ripper.so(parser_yylex+0x5c)
[0x7fc03e729345] ripper.y:7676
/home/ruby/tst1/lib/ruby/2.2.0/x86_64-linux/ripper.so(yylex+0x3f)
[0x7fc03e72b004] ripper.y:8334
/home/ruby/tst1/lib/ruby/2.2.0/x86_64-linux/ripper.so(ripper_yyparse+0x383)
[0x7fc03e71b899] parse.c:4767
/home/ruby/tst1/lib/ruby/2.2.0/x86_64-linux/ripper.so(ripper_parse0+0x3b)
[0x7fc03e72d1b8] ripper.y:10853
/home/ruby/tst1/ruby/ruby(rb_ensure+0x148) [0x7fc0402194cf] eval.c:911
/home/ruby/tst1/lib/ruby/2.2.0/x86_64-linux/ripper.so(ripper_parse+0xe5)
[0x7fc03e72d2e3] ripper.y:10889
/home/ruby/tst1/ruby/ruby(call_cfunc_0+0x29) [0x7fc040331db2]
vm_insnhelper.c:1357
/home/ruby/tst1/ruby/ruby(vm_call_cfunc_with_frame+0x1fc)
[0x7fc0403328a6] vm_insnhelper.c:1523
/home/ruby/tst1/ruby/ruby(vm_call_cfunc+0x2b) [0x7fc0403329af]
vm_insnhelper.c:1613
/home/ruby/tst1/ruby/ruby(vm_call_method+0x113) [0x7fc040333382]
vm_insnhelper.c:1801
/home/ruby/tst1/ruby/ruby(vm_call_general+0x2b) [0x7fc040333bdb]
vm_insnhelper.c:1960
/home/ruby/tst1/ruby/ruby(vm_exec_core+0x27d1) [0x7fc040337460]
insns.def:1028
/home/ruby/tst1/ruby/ruby(vm_exec+0xe4) [0x7fc040347838] vm.c:1367
/home/ruby/tst1/ruby/ruby(rb_iseq_eval_main+0x34) [0x7fc0403489cc]
vm.c:1637
/home/ruby/tst1/ruby/ruby(ruby_exec_internal+0x131) [0x7fc040217bbf]
eval.c:253
/home/ruby/tst1/ruby/ruby(ruby_exec_node+0x24) [0x7fc040217ce8]
eval.c:318
/home/ruby/tst1/ruby/ruby(ruby_run_node+0x3e) [0x7fc040217cbb]
eval.c:310
/home/ruby/tst1/ruby/ruby(main+0x71) [0x7fc040215a01] main.c:36
-- Other runtime information
-----------------------------------------------
* Loaded script: z.rb
* Loaded features:
0 enumerator.so
1 rational.so
2 complex.so
3 /home/ruby/tst1/lib/ruby/2.2.0/x86_64-linux/enc/encdb.so
4 /home/ruby/tst1/lib/ruby/2.2.0/x86_64-linux/enc/trans/transdb.so
5 /home/ruby/tst1/lib/ruby/2.2.0/x86_64-linux/rbconfig.rb
6 thread.rb
7 /home/ruby/tst1/lib/ruby/2.2.0/x86_64-linux/thread.so
8 /home/ruby/tst1/lib/ruby/2.2.0/rubygems/compatibility.rb
9 /home/ruby/tst1/lib/ruby/2.2.0/rubygems/defaults.rb
10 /home/ruby/tst1/lib/ruby/2.2.0/rubygems/deprecate.rb
11 /home/ruby/tst1/lib/ruby/2.2.0/rubygems/errors.rb
12 /home/ruby/tst1/lib/ruby/2.2.0/rubygems/version.rb
13 /home/ruby/tst1/lib/ruby/2.2.0/rubygems/requirement.rb
14 /home/ruby/tst1/lib/ruby/2.2.0/rubygems/platform.rb
15 /home/ruby/tst1/lib/ruby/2.2.0/rubygems/basic_specification.rb
16 /home/ruby/tst1/lib/ruby/2.2.0/rubygems/stub_specification.rb
17 /home/ruby/tst1/lib/ruby/2.2.0/rubygems/util/stringio.rb
18 /home/ruby/tst1/lib/ruby/2.2.0/rubygems/specification.rb
19 /home/ruby/tst1/lib/ruby/2.2.0/rubygems/exceptions.rb
20 /home/ruby/tst1/lib/ruby/2.2.0/rubygems/core_ext/kernel_gem.rb
21 /home/ruby/tst1/lib/ruby/2.2.0/monitor.rb
22 /home/ruby/tst1/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb
23 /home/ruby/tst1/lib/ruby/2.2.0/rubygems.rb
24 /home/ruby/tst1/lib/ruby/2.2.0/x86_64-linux/ripper.so
25 /home/ruby/tst1/lib/ruby/2.2.0/ripper/core.rb
26 /home/ruby/tst1/lib/ruby/2.2.0/ripper/lexer.rb
27 /home/ruby/tst1/lib/ruby/2.2.0/ripper/filter.rb
28 /home/ruby/tst1/lib/ruby/2.2.0/ripper/sexp.rb
29 /home/ruby/tst1/lib/ruby/2.2.0/ripper.rb
* Process memory map:
7fc03dd78000-7fc03df1e000 r--s 00000000 08:01 11799878
/lib/x86_64-linux-gnu/libc-2.19.so
7fc03df1e000-7fc03df95000 r--s 00000000 08:01 15859726
/home/ruby/tst1/lib/ruby/2.2.0/x86_64-linux/ripper.so
7fc03df95000-7fc03e4fb000 r--s 00000000 08:01 15073361
/home/ruby/tst1/ruby/ruby
7fc03e4fb000-7fc03e511000 r-xp 00000000 08:01 11796487
/lib/x86_64-linux-gnu/libgcc_s.so.1
7fc03e511000-7fc03e710000 ---p 00016000 08:01 11796487
/lib/x86_64-linux-gnu/libgcc_s.so.1
7fc03e710000-7fc03e711000 rw-p 00015000 08:01 11796487
/lib/x86_64-linux-gnu/libgcc_s.so.1
7fc03e711000-7fc03e741000 r-xp 00000000 08:01 15859726
/home/ruby/tst1/lib/ruby/2.2.0/x86_64-linux/ripper.so
7fc03e741000-7fc03e940000 ---p 00030000 08:01 15859726
/home/ruby/tst1/lib/ruby/2.2.0/x86_64-linux/ripper.so
7fc03e940000-7fc03e943000 rw-p 0002f000 08:01 15859726
/home/ruby/tst1/lib/ruby/2.2.0/x86_64-linux/ripper.so
7fc03e943000-7fc03e946000 r-xp 00000000 08:01 15859747
/home/ruby/tst1/lib/ruby/2.2.0/x86_64-linux/thread.so
7fc03e946000-7fc03eb46000 ---p 00003000 08:01 15859747
/home/ruby/tst1/lib/ruby/2.2.0/x86_64-linux/thread.so
7fc03eb46000-7fc03eb47000 rw-p 00003000 08:01 15859747
/home/ruby/tst1/lib/ruby/2.2.0/x86_64-linux/thread.so
7fc03eb47000-7fc03eb49000 r-xp 00000000 08:01 15859769
/home/ruby/tst1/lib/ruby/2.2.0/x86_64-linux/enc/trans/transdb.so
7fc03eb49000-7fc03ed49000 ---p 00002000 08:01 15859769
/home/ruby/tst1/lib/ruby/2.2.0/x86_64-linux/enc/trans/transdb.so
7fc03ed49000-7fc03ed4a000 rw-p 00002000 08:01 15859769
/home/ruby/tst1/lib/ruby/2.2.0/x86_64-linux/enc/trans/transdb.so
7fc03ed4a000-7fc03ed4c000 r-xp 00000000 08:01 15859801
/home/ruby/tst1/lib/ruby/2.2.0/x86_64-linux/enc/encdb.so
7fc03ed4c000-7fc03ef4b000 ---p 00002000 08:01 15859801
/home/ruby/tst1/lib/ruby/2.2.0/x86_64-linux/enc/encdb.so
7fc03ef4b000-7fc03ef4c000 rw-p 00001000 08:01 15859801
/home/ruby/tst1/lib/ruby/2.2.0/x86_64-linux/enc/encdb.so
7fc03ef4c000-7fc03f04d000 rw-p 00000000 00:00 0
7fc03f04d000-7fc03f1ec000 r-xp 00000000 08:01 11799878
/lib/x86_64-linux-gnu/libc-2.19.so
7fc03f1ec000-7fc03f3eb000 ---p 0019f000 08:01 11799878
/lib/x86_64-linux-gnu/libc-2.19.so
7fc03f3eb000-7fc03f3ef000 r--p 0019e000 08:01 11799878
/lib/x86_64-linux-gnu/libc-2.19.so
7fc03f3ef000-7fc03f3f1000 rw-p 001a2000 08:01 11799878
/lib/x86_64-linux-gnu/libc-2.19.so
7fc03f3f1000-7fc03f3f5000 rw-p 00000000 00:00 0
7fc03f3f5000-7fc03f4f5000 r-xp 00000000 08:01 11799873
/lib/x86_64-linux-gnu/libm-2.19.so
7fc03f4f5000-7fc03f6f4000 ---p 00100000 08:01 11799873
/lib/x86_64-linux-gnu/libm-2.19.so
7fc03f6f4000-7fc03f6f5000 r--p 000ff000 08:01 11799873
/lib/x86_64-linux-gnu/libm-2.19.so
7fc03f6f5000-7fc03f6f6000 rw-p 00100000 08:01 11799873
/lib/x86_64-linux-gnu/libm-2.19.so
7fc03f6f6000-7fc03f6fe000 r-xp 00000000 08:01 11799883
/lib/x86_64-linux-gnu/libcrypt-2.19.so
7fc03f6fe000-7fc03f8fd000 ---p 00008000 08:01 11799883
/lib/x86_64-linux-gnu/libcrypt-2.19.so
7fc03f8fd000-7fc03f8fe000 r--p 00007000 08:01 11799883
/lib/x86_64-linux-gnu/libcrypt-2.19.so
7fc03f8fe000-7fc03f8ff000 rw-p 00008000 08:01 11799883
/lib/x86_64-linux-gnu/libcrypt-2.19.so
7fc03f8ff000-7fc03f92d000 rw-p 00000000 00:00 0
7fc03f92d000-7fc03f930000 r-xp 00000000 08:01 11796508
/lib/x86_64-linux-gnu/libdl-2.19.so
7fc03f930000-7fc03fb2f000 ---p 00003000 08:01 11796508
/lib/x86_64-linux-gnu/libdl-2.19.so
7fc03fb2f000-7fc03fb30000 r--p 00002000 08:01 11796508
/lib/x86_64-linux-gnu/libdl-2.19.so
7fc03fb30000-7fc03fb31000 rw-p 00003000 08:01 11796508
/lib/x86_64-linux-gnu/libdl-2.19.so
7fc03fb31000-7fc03fbb2000 r-xp 00000000 08:01 16780134
/usr/lib/x86_64-linux-gnu/libgmp.so.10.2.0
7fc03fbb2000-7fc03fdb2000 ---p 00081000 08:01 16780134
/usr/lib/x86_64-linux-gnu/libgmp.so.10.2.0
7fc03fdb2000-7fc03fdb3000 r--p 00081000 08:01 16780134
/usr/lib/x86_64-linux-gnu/libgmp.so.10.2.0
7fc03fdb3000-7fc03fdb4000 rw-p 00082000 08:01 16780134
/usr/lib/x86_64-linux-gnu/libgmp.so.10.2.0
7fc03fdb4000-7fc03fdcc000 r-xp 00000000 08:01 11799871
/lib/x86_64-linux-gnu/libpthread-2.19.so
7fc03fdcc000-7fc03ffcb000 ---p 00018000 08:01 11799871
/lib/x86_64-linux-gnu/libpthread-2.19.so
7fc03ffcb000-7fc03ffcc000 r--p 00017000 08:01 11799871
/lib/x86_64-linux-gnu/libpthread-2.19.so
7fc03ffcc000-7fc03ffcd000 rw-p 00018000 08:01 11799871
/lib/x86_64-linux-gnu/libpthread-2.19.so
7fc03ffcd000-7fc03ffd1000 rw-p 00000000 00:00 0
7fc03ffd1000-7fc03fff1000 r-xp 00000000 08:01 11799884
/lib/x86_64-linux-gnu/ld-2.19.so
7fc040002000-7fc0400a6000 r--s 00000000 08:01 16913977
/usr/lib/debug/lib/x86_64-linux-gnu/libpthread-2.19.so
7fc0400a6000-7fc0400c8000 r--s 00000000 08:01 11799871
/lib/x86_64-linux-gnu/libpthread-2.19.so
7fc0400c8000-7fc0401d0000 r--p 00000000 08:01 16781848
/usr/lib/locale/locale-archive
7fc0401d0000-7fc0401d5000 rw-p 00000000 00:00 0
7fc0401ea000-7fc0401eb000 rw-p 00000000 00:00 0
7fc0401eb000-7fc0401ec000 ---p 00000000 00:00 0
7fc0401ec000-7fc0401f1000 rw-p 00000000 00:00 0
[stack:16182]
7fc0401f1000-7fc0401f2000 r--p 00020000 08:01 11799884
/lib/x86_64-linux-gnu/ld-2.19.so
7fc0401f2000-7fc0401f3000 rw-p 00021000 08:01 11799884
/lib/x86_64-linux-gnu/ld-2.19.so
7fc0401f3000-7fc0401f4000 rw-p 00000000 00:00 0
7fc0401f4000-7fc0404a6000 r-xp 00000000 08:01 15073361
/home/ruby/tst1/ruby/ruby
7fc0406a6000-7fc0406ac000 rw-p 002b2000 08:01 15073361
/home/ruby/tst1/ruby/ruby
7fc0406ac000-7fc0406bf000 rw-p 00000000 00:00 0
7fc042631000-7fc042b35000 rw-p 00000000 00:00 0
[heap]
7fffbe5d4000-7fffbe5f5000 rw-p 00000000 00:00 0
7fffbe5fc000-7fffbe5fe000 r-xp 00000000 00:00 0
[vdso]
7fffbe5fe000-7fffbe600000 r--p 00000000 00:00 0
[vvar]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0
[vsyscall]
[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