[Bug #705] sample/test.rb:1829: [BUG] Segmentation fault

Bug #705: sample/test.rb:1829: [BUG] Segmentation fault
http://redmine.ruby-lang.org/issues/show/705

e$B5/I<<Te(B: pegacorn jp
e$B%9%F!<%?%9e(B: Open, e$BM%@hEYe(B: High

r19078 e$B0J9_e(B SEGV e$B$7$^$9!#e(B

D:\work\ruby_1_8-r19078\win32>nmake test

Microsoft (R) Program Maintenance Utility   Version 6.00.9782.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.

./../sample/test.rb:1829: [BUG] Segmentation fault
ruby 1.8.7 (2008-09-02 revision 19404) [i386-mswin32]

abnormal program termination
test failed
NMAKE : fatal error U1077: '.\miniruby.exe' : e$B%j%?!<%se(B 

e$B%3!<%Ie(B ‘0x1’
Stop.

e$B$J$+$@$G$9!#e(B

At Sat, 1 Nov 2008 12:52:56 +0900,
pegacorn jp wrote in [ruby-dev:37008]:

abnormal program termination
test failed
NMAKE : fatal error U1077: '.\miniruby.exe' : e$B%j%?!<%se(B e$B%3!<%Ie(B '0x1'
Stop.

VC6e$B$G$9$h$Me(B?
e$B$H$j$"$($::G?7HG$G;n$7$F$_$?$N$G$9$,:F8=$G$-$^$;$se(B
e$B$G$7$?!#e(BVCe$B$N%G%P%C%,$G%P%C%/%H%l!<%9$H$+$H$l$J$$$G$7$g$&$+!#e(B

e$B%A%1%C%He(B #705 e$B$,99?7$5$l$^$7$?!#e(B (by pegacorn jp)

Windows 2000(SP4) + VC6(SP6) e$B$G$9!#e(B

msdev ruby.exe -I../lib ./../sample/test.rb

e$B$G%3!<%k%9%?%C%/$,<h$l$^$7$?!#e(B

---- e$B$3$3$+$ie(B
NTDLL! 77f9193c()
NTDLL! 77f9c73e()
NTDLL! 77fb064e()
NTDLL! 77f9bd5a()
NTDLL! 77fcb63e()
MSVCRT! 78001532()
MSVCRT! 780014cf()
st_insert(st_table * 0x02ce1c48, unsigned long 3137, unsigned long
48541080) line 293 + 51 bytes
clone_method() line 70 + 39 bytes
st_foreach(st_table * 0x02a7e140, int (void)* 0x100474c0
clone_method(void), unsigned long 37806436) line 487 + 21 bytes
rb_mod_init_copy(unsigned long 48541400, unsigned long 44819520) line
100 + 21 bytes
rb_class_init_copy(unsigned long 48541400, unsigned long 44819520) line
117 + 13 bytes
rb_call0() line 5906 + 205 bytes
rb_call(unsigned long 44830020, unsigned long 48541400, unsigned long
2969, int 1, const unsigned long * 0x0240e3c0, int 1, unsigned long 6)
line 6153 + 37 bytes
vafuncall() line 6230 + 133 bytes
rb_funcall(unsigned long 48541400, unsigned long 2969, int 1) line 6247

  • 21 bytes
    init_copy() line 188 + 21 bytes
    rb_obj_clone(unsigned long 44819520) line 227 + 13 bytes
    rb_call0() line 5906 + 178 bytes
    rb_call(unsigned long 44829920, unsigned long 44819520, unsigned long
    3065, int 0, const unsigned long * 0x00000000, int 0, unsigned long
  1. line 6153 + 37 bytes
    rb_eval(unsigned long 44824980, RNode * 0x02b1f4c0) line 3494 + 186
    bytes
    rb_eval(unsigned long 44824980, RNode * 0x02aaf8f0) line 3704 + 16 bytes
    eval_node() line 1438 + 13 bytes
    ruby_exec_internal() line 1643 + 18 bytes
    ruby_exec() line 1664
    ruby_run() line 1673 + 5 bytes
    main() line 51
    RUBY! mainCRTStartup + 227 bytes
    KERNEL32! 77e789d5()
    ---- e$B$3$3$^$Ge(B

e$B$3$ND>A0$O!"0J2<$NDL$j$G$9!#e(B

---- e$B$3$3$+$ie(B
ruby_xmalloc(long 16) line 159 + 5 bytes
st_insert(st_table * 0x02ce1c48, unsigned long 3137, unsigned long
48541080) line 293 + 51 bytes
e$B!J8eN,!Ke(B
---- e$B$3$3$^$Ge(B


http://redmine.ruby-lang.org/issues/show/705

e$B$J$+$@$G$9!#e(B

At Mon, 3 Nov 2008 09:33:54 +0900,
pegacorn jp wrote in [ruby-dev:37016]:

r19078 e$B$NJQ99$G!"e(B
marshal_load e$B$,!"e(Bload_ensure e$B$G2rJ|$7$?NN0h$r;HMQ$9$k$h$&$K$J$C$Fe(B
e$B%R!<%W$rGK2u$7$F$$$^$9!#e(B

e$B$H$$$&$+e(Barg.datae$B$O$b$&e(BHashe$B$G$O$J$$$N$Ge(Bmarshal_loade$B$N$[$&$,>C$7K:e(B
e$B$l$G$9$M!#e(B

    RBASIC(arg.data)->klass = rb_cHash;  /* <-- e$B$3$3$G;HMQe(B */

e$B$3$N9T$r>C$7$?$i2r7h$7$^$9$+e(B?

e$B%A%1%C%He(B #705 e$B$,99?7$5$l$^$7$?!#e(B (by pegacorn jp)

r19078 e$B$NJQ99$G!"e(B
marshal_load e$B$,!"e(Bload_ensure
e$B$G2rJ|$7$?NN0h$r;HMQ$9$k$h$&$K$J$C$Fe(B
e$B%R!<%W$rGK2u$7$F$$$^$9!#e(B

static VALUE
load_ensure(arg)
    struct load_arg *arg;
{
    if (!DATA_PTR(arg->wrapper)) return 0;
    st_free_table(arg->symbols);
    st_free_table(arg->data);    /* <-- e$B$3$3$G2rJ|e(B */
    DATA_PTR(arg->wrapper) = 0;
    arg->wrapper = 0;
    return 0;
}

static VALUE
marshal_load(argc, argv)
    int argc;
    VALUE *argv;
{
    e$B!J>JN,!Ke(B
    v = rb_ensure(load, (VALUE)&arg, load_ensure, (VALUE)&arg);
    RBASIC(arg.data)->klass = rb_cHash;  /* <-- e$B$3$3$G;HMQe(B */

    return v;
}

http://redmine.ruby-lang.org/issues/show/705

e$B%A%1%C%He(B #705 e$B$,99?7$5$l$^$7$?!#e(B (by pegacorn jp)

    RBASIC(arg.data)->klass = rb_cHash;  /* <-- e$B$3$3$G;HMQe(B */

e$B$3$N9T$r>C$7$?$i2r7h$7$^$9$+e(B?

e$B$O$$!#e(BSEGV e$B$7$J$/$J$j$^$7$?!#e(B

D:\work\ruby_1_8-r19078\win32>nmake test

Microsoft (R) Program Maintenance Utility   Version 6.00.9782.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.

test succeeded

http://redmine.ruby-lang.org/issues/show/705

e$B%A%1%C%He(B #705 e$B$,99?7$5$l$^$7$?!#e(B (by Nobuyoshi N.)

e$B%9%F!<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B
e$B?JD=e(B % 0e$B$+$ie(B100e$B$KJQ99e(B

Applied in changeset r20097.

http://redmine.ruby-lang.org/issues/show/705