1.8 Marshal.load(open("/dev/null"))

rubyspec e$B$,Mn$A$F$$$?$N$G$A$g$C$H$$F$$?$H$3$m!"0J2<$G4qL/e(B
e$B$JF0:n$r$9$k$h$&$G$9!#e(B
http://www.rubyist.net/~akr/chkbuild/debian-sarge/ruby-1.8/log/20080524T103507.txt.gz

% ./ruby -ve ‘Marshal.load(open(“/dev/null”))’
ruby 1.8.7 (2008-05-24 patchlevel 5000) [i686-linux]
-e:1:in `load’: getc reentered (RuntimeError)
from -e:1
zsh: exit 1 ./ruby -ve ‘Marshal.load(open(“/dev/null”))’

valgrind e$B$r$+$1$F$_$k$H$J$K$+=P$F$-$^$9!#e(B

% valgrind ./ruby -e ‘Marshal.load(open(“/dev/null”))’
==12994== Memcheck, a memory error detector.
==12994== Copyright (C) 2002-2006, and GNU GPL’d, by Julian Seward et
al.
==12994== Using LibVEX rev 1658, a library for dynamic binary
translation.
==12994== Copyright (C) 2004-2006, and GNU GPL’d, by OpenWorks LLP.
==12994== Using valgrind-3.2.1-Debian, a dynamic binary instrumentation
framework.
==12994== Copyright (C) 2000-2006, and GNU GPL’d, by Julian Seward et
al.
==12994== For more details, rerun with: -v
==12994==
==12994== Use of uninitialised value of size 4
==12994== at 0x807F986: reentrant_check (marshal.c:92)
==12994== by 0x807FA2C: r_byte (marshal.c:826)
==12994== by 0x807FAFE: marshal_load (marshal.c:1435)
==12994== by 0x805646D: call_cfunc (eval.c:5743)
==12994== by 0x805F731: rb_call0 (eval.c:5899)
==12994== by 0x8060400: rb_call (eval.c:6146)
==12994== by 0x805DB99: rb_eval (eval.c:3492)
==12994== by 0x806B21D: ruby_exec_internal (eval.c:1642)
==12994== by 0x806B255: ruby_exec (eval.c:1662)
==12994== by 0x806B280: ruby_run (eval.c:1672)
==12994== by 0x80533FE: main (main.c:48)
-e:1:in `load’: getc reentered (RuntimeError)
from -e:1
==12994==
==12994== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 17 from
1)
==12994== malloc/free: in use at exit: 341,490 bytes in 7,626 blocks.
==12994== malloc/free: 7,899 allocs, 273 frees, 345,017 bytes allocated.
==12994== For counts of detected errors, rerun with: -v
==12994== searching for pointers to 7,626 not-freed blocks.
==12994== checked 554,296 bytes.
==12994==
==12994== LEAK SUMMARY:
==12994== definitely lost: 0 bytes in 0 blocks.
==12994== possibly lost: 0 bytes in 0 blocks.
==12994== still reachable: 341,490 bytes in 7,626 blocks.
==12994== suppressed: 0 bytes in 0 blocks.
==12994== Reachable blocks (those to which a pointer was found) are not
shown.
==12994== To see them, rerun with: --show-reachable=yes
zsh: exit 1 valgrind ./ruby -e ‘Marshal.load(open(“/dev/null”))’

At Sat, 24 May 2008 11:20:12 +0900,
Tanaka A. wrote:

rubyspec が落ちていたのでちょっとみてみたところ、以下で奇妙
な動作をするようです。
http://www.rubyist.net/~akr/chkbuild/debian-sarge/ruby-1.8/log/20080524T103507.txt.gz

% ./ruby -ve ‘Marshal.load(open(“/dev/null”))’
ruby 1.8.7 (2008-05-24 patchlevel 5000) [i686-linux]
-e:1:in `load’: getc reentered (RuntimeError)
from -e:1
zsh: exit 1 ./ruby -ve ‘Marshal.load(open(“/dev/null”))’

ありがとうございます。まつもとさんが修正したようです。