[ruby-dev:24279] Array#transpose causes core dump

From: Tanaka Akira <akr@...17n.org>
Date: 2004-09-16 20:57:18 UTC
List: ruby-dev #24279
次のようにすると core を吐きます。

% ./ruby -e '         
def m(a)
  ObjectSpace.define_finalizer(Object.new) {
    a.clear
    a.compact!
  }
end
arr = [(0..10000).to_a]
m(arr[0])
p arr.transpose
'
-e:10: [BUG] Segmentation fault
ruby 1.9.0 (2004-09-16) [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 
def m(a)
  ObjectSpace.define_finalizer(Object.new) {
    a.clear
 '.
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  0x080d0b96 in rb_bug (fmt=0x0) at error.c:214
#4  0x080af192 in sigsegv (sig=11) at signal.c:446
#5  <signal handler called>
#6  0x401a5a4e in __curbrk () from /lib/libc.so.6
#7  0xbfffe564 in ?? ()
#8  0xbfffe568 in ?? ()
#9  0xbfffe56c in ?? ()
#10 0xbfffe570 in ?? ()
#11 0x401a53cc in __after_morecore_hook () from /lib/libc.so.6
#12 0x401a53cc in __after_morecore_hook () from /lib/libc.so.6
#13 0x401a53cc in __after_morecore_hook () from /lib/libc.so.6
#14 0x401a53cc in __after_morecore_hook () from /lib/libc.so.6
#15 0x401a53cc in __after_morecore_hook () from /lib/libc.so.6
#16 0x401a53cc in __after_morecore_hook () from /lib/libc.so.6
#17 0x401a53cc in __after_morecore_hook () from /lib/libc.so.6
#18 0x401a53cc in __after_morecore_hook () from /lib/libc.so.6
#19 0x401a53cc in __after_morecore_hook () from /lib/libc.so.6
#20 0x401a53cc in __after_morecore_hook () from /lib/libc.so.6
#21 0x401a53cc in __after_morecore_hook () from /lib/libc.so.6
#22 0x401a53cc in __after_morecore_hook () from /lib/libc.so.6
#23 0x401a53cc in __after_morecore_hook () from /lib/libc.so.6
#24 0x401a53cc in __after_morecore_hook () from /lib/libc.so.6
#25 0x401a53cc in __after_morecore_hook () from /lib/libc.so.6
#26 0x401a53cc in __after_morecore_hook () from /lib/libc.so.6
#27 0x401a53cc in __after_morecore_hook () from /lib/libc.so.6
#28 0x401a53cc in __after_morecore_hook () from /lib/libc.so.6
#29 0x401a53cc in __after_morecore_hook () from /lib/libc.so.6
#30 0x080b19b7 in st_lookup (table=0x401a53cc, key=3168, value=0xbfffe5f8)
    at st.c:258
#31 0x080540e3 in search_method (klass=1075467212, id=3169, origin=0xbfffe624)
    at eval.c:380
#32 0x08054139 in rb_get_method_body (klassp=0xbfffe680, idp=0xbfffe664, 
    noexp=0xbfffe668) at eval.c:401
#33 0x0805e31a in rb_call (klass=1075467212, recv=1075467220, mid=3169, 
    argc=0, argv=0x0, scope=1) at eval.c:5701
#34 0x0805e744 in rb_funcall (recv=1075467220, mid=1075488343, n=0)
---Type <return> to continue, or q <return> to quit---
    at ruby.h:634
#35 0x08085cd6 in rb_inspect (obj=1075488343) at object.c:345
#36 0x080c4451 in inspect_ary (ary=1075607256) at array.c:1528
#37 0x080c41b8 in inspect_call (arg=0x401a53cc) at array.c:1447
#38 0x0805d499 in rb_ensure (b_proc=0x80c41a0 <inspect_call>, 
    data1=3221219344, e_proc=0x80c42a0 <inspect_ensure>, data2=1075607256)
    at eval.c:5173
#39 0x080c435f in rb_protect_inspect (func=0x80c43b0 <inspect_ary>, 
    obj=1075607256, arg=0) at array.c:1504
#40 0x080c4506 in rb_ary_inspect (ary=1075607256) at array.c:1551
#41 0x08069e91 in call_cfunc (func=0x80c44b0 <rb_ary_inspect>, 
    recv=1075607256, len=1075467212, argc=135280608, argv=0x0) at eval.c:5367
#42 0x0805e117 in rb_call0 (klass=1075647656, recv=1075607256, id=3169, 
    oid=1075488343, argc=0, argv=0x0, body=0x401d13a4, nosuper=0)
    at eval.c:5504
#43 0x0805e3c8 in rb_call (klass=1075647656, recv=1075607256, mid=3169, 
    argc=0, argv=0x0, scope=1) at eval.c:5725
#44 0x0805e744 in rb_funcall (recv=1075607256, mid=1075488343, n=0)
    at ruby.h:634
#45 0x08085cd6 in rb_inspect (obj=1075488343) at object.c:345
#46 0x080c4451 in inspect_ary (ary=1075607956) at array.c:1528
#47 0x080c41b8 in inspect_call (arg=0x401a53cc) at array.c:1447
#48 0x0805d499 in rb_ensure (b_proc=0x80c41a0 <inspect_call>, 
    data1=3221220368, e_proc=0x80c42a0 <inspect_ensure>, data2=1075607956)
    at eval.c:5173
#49 0x080c435f in rb_protect_inspect (func=0x80c43b0 <inspect_ary>, 
    obj=1075607956, arg=0) at array.c:1504
#50 0x080c4506 in rb_ary_inspect (ary=1075607956) at array.c:1551
#51 0x08069e91 in call_cfunc (func=0x80c44b0 <rb_ary_inspect>, 
    recv=1075607956, len=1075467212, argc=135280608, argv=0x0) at eval.c:5367
#52 0x0805e117 in rb_call0 (klass=1075647656, recv=1075607956, id=3169, 
    oid=1075488343, argc=0, argv=0x0, body=0x401d13a4, nosuper=0)
    at eval.c:5504
#53 0x0805e3c8 in rb_call (klass=1075647656, recv=1075607956, mid=3169, 
    argc=0, argv=0x0, scope=1) at eval.c:5725
#54 0x0805e744 in rb_funcall (recv=1075607956, mid=1075488343, n=0)
    at ruby.h:634
#55 0x08085cd6 in rb_inspect (obj=1075488343) at object.c:345
#56 0x08079701 in rb_p (obj=1075488343) at io.c:3747
---Type <return> to continue, or q <return> to quit---
#57 0x080797b2 in rb_f_p (argc=1, argv=0xbffff138) at io.c:3777
#58 0x08069e8a in call_cfunc (func=0x8079740 <rb_f_p>, recv=1075673496, 
    len=1075467212, argc=135280608, argv=0xbffff138) at eval.c:5364
#59 0x0805e117 in rb_call0 (klass=1075678376, recv=1075673496, id=7401, 
    oid=1075488343, argc=1, argv=0xbffff138, body=0x401cea8c, nosuper=0)
    at eval.c:5504
#60 0x0805e3c8 in rb_call (klass=1075678376, recv=1075673496, mid=7401, 
    argc=1, argv=0xbffff138, scope=1) at eval.c:5725
#61 0x08059308 in rb_eval (self=1075673496, n=0x401aa657) at ruby.h:634
#62 0x0805589b in ruby_exec () at eval.c:1458
#63 0x080558e0 in ruby_run () at eval.c:1479
#64 0x080539b5 in main (argc=1075488343, argv=0x401aa657, envp=0xbffff914)
    at main.c:38
(gdb) 
-- 
[田中 哲][たなか あきら][Tanaka Akira]

In This Thread

Prev Next