[ruby-dev:24373] eval dumps core

From: Tanaka Akira <akr@...17n.org>
Date: 2004-09-30 04:02:23 UTC
List: ruby-dev #24373
次のようにすると core を吐きます。

% ./ruby -e '
file = "\0" * 0x20000
file[0,3] = "aaa"
line = Object.new
class << line; self end.send(:define_method, :to_int) {
  file.replace ""
  10
}
eval("p __FILE__", nil, file, line)
'
-e:9: [BUG] Segmentation fault
ruby 1.9.0 (2004-09-30) [i686-linux]

zsh: abort (core dumped)  ./ruby -e 
% gdb ruby core
GNU gdb 6.1-debian
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-linux"...Using host libthread_db library "/lib/libthread_db.so.1".

Core was generated by `./ruby -e 
file = "\0" * 0x20000
file[0,3] = "aaa"
line = Object.new
class << l'.
Program terminated with signal 6, Aborted.
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/libcrypt.so.1...done.
Loaded symbols for /lib/libcrypt.so.1
Reading symbols from /lib/libm.so.6...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
#0  0x4009e721 in kill () from /lib/libc.so.6
(gdb) bt
#0  0x4009e721 in kill () from /lib/libc.so.6
#1  0x4009e4c5 in raise () from /lib/libc.so.6
#2  0x4009f9e8 in abort () from /lib/libc.so.6
#3  0x080d1f86 in rb_bug (fmt=0x0) at error.c:214
#4  0x080aff92 in sigsegv (sig=11) at signal.c:446
#5  <signal handler called>
#6  strhash (string=0x401d9008 <Address 0x401d9008 out of bounds>) at st.c:563
#7  0x080b27b7 in st_lookup (table=0x8138aa8, key=1075679240, value=0xbfffec58) at st.c:258
#8  0x0806f94a in rb_source_filename (f=0x401d9008 <Address 0x401d9008 out of bounds>) at gc.c:520
#9  0x08092efd in yycompile (parser=0x813a0b8, f=0x401d9008 <Address 0x401d9008 out of bounds>, line=0) at parse.y:4329
#10 0x080931a4 in rb_compile_string (f=0x8138aa8 "\217\017\b\v", s=135498408, line=10) at parse.y:4401
#11 0x0805ee14 in compile (src=1075607536, file=0x80f8fc8 "0/\005\b.\v\b", line=135237576) at eval.c:6005
#12 0x0805f312 in eval (self=1075673496, src=1075607536, scope=4, file=0x401d9008 <Address 0x401d9008 out of bounds>, 
    line=10) at eval.c:6086
#13 0x0805f5d1 in rb_f_eval (argc=-1073745840, argv=0x80f8fc8, self=1075673496) at eval.c:6204
#14 0x08069f6a in call_cfunc (func=0x805f460 <rb_f_eval>, recv=1075673496, len=135498408, argc=1075679240, argv=0xbffff108)
    at eval.c:5368
#15 0x0805e187 in rb_call0 (klass=1075678376, recv=1075673496, id=3953, oid=135237576, argc=4, argv=0xbffff108, 
    body=0x401d71c8, nosuper=0) at eval.c:5509
#16 0x0805e438 in rb_call (klass=1075678376, recv=1075673496, mid=3953, argc=4, argv=0xbffff108, scope=1) at eval.c:5730
#17 0x08059368 in rb_eval (self=1075673496, n=0x80f8fc8) at ruby.h:635
#18 0x080558fb in ruby_exec () at eval.c:1458
#19 0x08055940 in ruby_run () at eval.c:1484
#20 0x08053a05 in main (argc=135237576, argv=0x80f8fc8, envp=0xbffff8e4) at main.c:38
(gdb) 
-- 
[田中 哲][たなか あきら][Tanaka Akira]

In This Thread

Prev Next