[Bug #650] Marshal.load raises RegexpError


#1

Bug #650: Marshal.load raises RegexpError
http://redmine.ruby-lang.org/issues/show/650

e$B5/I<<Te(B: Shyouhei U.
e$B%9%F!<%?%9e(B: Open, e$BM%@hEYe(B: Normal
e$B%+%F%4%je(B: M17N

e$B0J2<$N$h$&$K!"0JA0$N%P!<%8%g%s$Ne(BRubye$B$G@5$7$/e(Bdumpe$B$7$?$O$:$NJ8;zNs$re(Btrunke$B$Ge(Bloade$B$G$-$^$;$s!#e(B

% ruby1.8 -e ‘Marshal.dump(/C:\Documents and Settings\urabe/, STDOUT)’
| ruby1.8 -ve ‘p Marshal.load(STDIN)’
ruby 1.8.7 (2008-10-11 revision 17572) [x86_64-linux]
/C:\Documents and Settings\urabe/

% ruby1.8 -e ‘Marshal.dump(/C:\Documents and Settings\urabe/, STDOUT)’
| ruby1.9 -ve ‘p Marshal.load(STDIN)’
ruby 1.9.0 (2008-10-13 revision 17576) [x86_64-linux]
-e:1:in load': invalid Unicode escape: /C:\Documents and Settings\urabe/ (RegexpError) from -e:1:in


#2

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:36750] [Bug #650] Marshal.load raises
RegexpError”
on Wed, 15 Oct 2008 22:59:59 +0900, Shyouhei U.
removed_email_address@domain.invalid writes:

|e$B0J2<$N$h$&$K!"0JA0$N%P!<%8%g%s$Ne(BRubye$B$G@5$7$/e(Bdumpe$B$7$?$O$:$NJ8;zNs$re(Btrunke$B$Ge(Bloade$B$G$-$^$;$s!#e(B
|
| % ruby1.8 -e ‘Marshal.dump(/C:\Documents and Settings\urabe/, STDOUT)’ | ruby1.8 -ve ‘p Marshal.load(STDIN)’
| ruby 1.8.7 (2008-10-11 revision 17572) [x86_64-linux]
| /C:\Documents and Settings\urabe/

1.9e$B$G$O@55,I=8=$Ke(B\ue$B$,A}$($?$+$i$G$9$M!#e(B

e$B87L)$K8@$&$He(Bmarshale$B$K>e0L8_49@-$,$J$$$N$Ge(Bmarshale$B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$B;W$$$^$9!#$=$&$9$k$H!”>e$N$@$He(B

C:\Documents and Settingsurabe

e$B$K$J$C$F$7$^$&$o$1$G$9$,!"$b$H$b$He(B\De$B$Oe(B[0-9]e$B$H$$$&0UL#$G!">e$Ne(B
e$B@55,I=8=$O$b$H$b$H%Q%9$K$O%^%C%A$7$J$$$s$G!"$3$l$O$3$&$$$&$be(B
e$B$N$@$H;W$C$F$/$@$5$$!#%P%C%/%9%i%C%7%e$r4^$`%Q%?!<%s$O$A$c$se(B
e$B$He(B\e$B$KJQ49$7$F$/$@$5$$$H$$$&$3$H$G!#e(B

e$B:#8ee(BMarshal.loade$B$5$l$k>l9g$K4X$7$F$OFC$KLdBj$,;W$$Ib$+$P$J$$$N$G$$$$$se(B
e$B$8$c$J$$$+$H;W$$$^$9$,!"$9$G$K:n$C$F$7$^$C$?e(BPStoree$B%G!<%?%Y!<%9$,:$$j$^e(B
e$B$9!"$H$$$&$+!"<j85$GFI$a$J$/$F<c43:$$C$F$$$k$o$1$G$9!#$J$K$+e(B(e$B%9%/%j%W%He(B
e$BB&$G$G$b$+$^$o$J$$$N$Ge(B)e$B4{B8$Ne(BMarshale$B:Q$%G!<%?$KBP$9$ke(Bworkarounde$B$$?$$$Je(B
e$B$b$N$O$J$$$G$7$g$&$+!#e(B


#4

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:36771] Re: [Bug #650] Marshal.load raises
RegexpError”
on Sat, 18 Oct 2008 01:05:25 +0900, Urabe S.
removed_email_address@domain.invalid writes:

|> e$B87L)$K8@$&$He(Bmarshale$B$K>e0L8_49@-$,$J$$$N$Ge(Bmarshale$B$N%a%8%c!<%P!<e(B
|> e$B%8%g%s$rJQ2=$5$;$k$Y$-$J$N$+$b$7$l$^$;$s$,!"%a%j%C%H$h$j$b%Ge(B
|> e$B%a%j%C%H$NJ}$,Bg$-$$$N$G$=$l$O$7$J$$J}8~$r9M$($F$^$9!#e(B

|e$B$A$J$_$K$I$&$$$&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$J$O$:$G$9!#e(B

e$B:#$G$b!"8E$$e(Bmarshal

formate$B$N%G!<%?$rFI$b$&$H$9$k$H!"7Y9p$,=P$k$,=hM}<+e(B
e$BBN$O$G$-$k$O$:!#e(B

|e$B$9$G$K:n$C$F$7$^$C$?e(BPStoree$B%G!<%?%Y!<%9$,:$$j$^e(B
|e$B$9!"$H$$$&$+!"<j85$GFI$a$J$/$F<c43:$$C$F$$$k$o$1$G$9!#$J$K$+e(B(e$B%9%/%j%W%He(B
|e$BB&$G$G$b$+$^$o$J$$$N$Ge(B)e$B4{B8$Ne(BMarshale$B:Q$%G!<%?$KBP$9$ke(Bworkarounde$B$$?$$$Je(B
|e$B$b$N$O$J$$$G$7$g$&$+!#e(B

e$B$3$l$+$i%3%_%C%H$9$k?7$7$$e(B1.8e$B$G8E$$e(Bmarshale$B%G!<%?$r0lEYFI$_9~e(B
e$B$s$G!"$U$?$?$S=q$-9~$`$3$H$Ge(B1.9e$B$G$bFI$a$k$h$&$K$G$-$^$9!#$C$F!"e(B
e$B$=$&$$$&$3$H$8$c$J$$$N$+$J!#e(B

e$B5$$E$$$?$s$G$9$1$I!"$=$l$@$He(B

% ruby1.9 -e ‘Marshal.dump(/\u0001/, STDOUT)’ |
ruby1.8 -e ‘Marshal.dump(Marshal.load(STDIN), STDOUT)’ |
ruby1.9 -e ‘p Marshal.load(STDIN)’

e$B$H$+$,e(Broud-tripe$B$7$J$/$J$k$H;W$&e(B(e$B$$$^$O$9$ke(B)e$B$s$G$9$1$I!"J?5$$J$s$G$9$+$M!#e(B


#6

In article removed_email_address@domain.invalid,
Urabe S. removed_email_address@domain.invalid writes:

e$B5$$E$$$?$s$G$9$1$I!"$=$l$@$He(B

% ruby1.9 -e ‘Marshal.dump(/\u0001/, STDOUT)’ |
ruby1.8 -e ‘Marshal.dump(Marshal.load(STDIN), STDOUT)’ |
ruby1.9 -e ‘p Marshal.load(STDIN)’

e$B$H$+$,e(Broud-tripe$B$7$J$/$J$k$H;W$&e(B(e$B$$$^$O$9$ke(B)e$B$s$G$9$1$I!"J?5$$J$s$G$9$+$M!#e(B

syntax e$B$He(B semantics e$B$N$I$A$i$rJ]B8$9$k$+$H$$$&$H!"e(Bsemantics
e$B$N$[$&$,$$$$$s$8$c$J$$$G$9$+$M!#e(B

e$B:#$O0J2<$N$h$&$K!"%^%C%A$9$k$b$N$,JQ2=$9$k$o$1$G!"$=$l$,JQ2=e(B
e$B$7$J$$$h$&$K$J$k$[$&$,$^$@%^%7$J$s$8$c$J$$$G$7$g$&$+!#e(B

% ruby-1.8 -e ‘print Marshal.dump(/\u0001/)’ > z
% ruby-1.8 -e ‘r = Marshal.load(STDIN); p ["\x01", “u0001”].map {|s| r
=~ s }’ < z
[nil, 0]
% ruby-1.9 -e ‘r = Marshal.load(STDIN); p ["\x01", “u0001”].map {|s| r
=~ s }’ < z
[0, nil]


#7

e$BKNIt$G$9!#e(B

Tanaka A. e$B$5$s$O=q$-$^$7$?e(B:

syntax e$B$He(B semantics e$B$N$I$A$i$rJ]B8$9$k$+$H$$$&$H!"e(Bsemantics
e$B$N$[$&$,$$$$$s$8$c$J$$$G$9$+$M!#e(B

e$B:#$O0J2<$N$h$&$K!"%^%C%A$9$k$b$N$,JQ2=$9$k$o$1$G!"$=$l$,JQ2=e(B
e$B$7$J$$$h$&$K$J$k$[$&$,$^$@%^%7$J$s$8$c$J$$$G$7$g$&$+!#e(B

semanticse$B$N$[$&$,J]B8$5$l$F$?$[$&$,$$$$$N$K$OG<F@$7$^$7$?$,!"?2ITB-$NF,e(B
e$B$G9M$($?$H$3$m$K$h$k$H!"$=$l$C$FL5M}$8$c$J$$e(B?

1.8e$B$He(B1.9e$B$O@55,I=8=%(%s%8%s$,0c$&$o$1$G!"$?$H$($Pe(B
/(?bar)/ e$B$H$+$Oe(B1.8
e$B$K;}$C$F$$$/$3$H$O$G$-$^$;$s$h$M!#e(B

e$B$^$"$D$^$j!“7k6I$N$H$3$me(BMarshale$B%G!<%?$re(B1.8e$B$G:n$C$Fe(B1.9e$B$GFI$$N$O$R$g$C$He(B e$B$7$F4hD%$l$P2DG=$+$b$7$l$J$$$1$I!"e(B1.9e$B$G:n$C$Fe(B1.8e$B$GFI$$N$O$”$+$i$5$^$KITe(B
e$B2DG=$J$N$G!“4hD%$l$k$K$7$F$b>e0L8_49$/$i$$$,4X$N;3$G!”$C$F$3$H$Oe(BMarshal
e$B$N%P!<%8%g%s$,F1$8$G$"$k$3$H$K8G<9$7$F$b0UL#$J$$$s$8$c$J$$$+$H$$$&5$$,$7e(B
e$B$F$-$?$s$G$9$,!"$I$&$G$7$g$&!#e(B


#8

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:36773] Re: [Bug #650] Marshal.load raises
RegexpError”
on Sat, 18 Oct 2008 07:05:07 +0900, Urabe S.
removed_email_address@domain.invalid writes:

|> |> e$B87L)$K8@$&$He(Bmarshale$B$K>e0L8_49@-$,$J$$$N$Ge(Bmarshale$B$N%a%8%c!<%P!<e(B
|> |> e$B%8%g%s$rJQ2=$5$;$k$Y$-$J$N$+$b$7$l$^$;$s$,!"%a%j%C%H$h$j$b%Ge(B
|> |> e$B%a%j%C%H$NJ}$,Bg$-$$$N$G$=$l$O$7$J$$J}8~$r9M$($F$^$9!#e(B
|>
|> |e$B$A$J$_$K$I$&$$$&%G%a%j%C%H$G$9$+e(B?
|>
|> 1.8e$B$He(B1.9e$B$Ge(Bmarshale$B%G!<%?$,A4$/$d$j$H$j$G$-$J$$$H$$$&%G%a%j%Ce(B
|> e$B%H$G$9!#e(B
|
|e$B$^$C$?$/$H$$$&$3$H$O$J$$$G$7$g$&!#e(B
|1.8e$B$G:n$C$?%G!<%?$re(B1.9e$B$,FI$a$h$&$Ke(B1.9e$B$r:n$k$N$O2DG=$J$O$:$G$9!#e(B
|# e$B:#$G$b!"8E$$e(Bmarshal formate$B$N%G!<%?$rFI$b$&$H$9$k$H!"7Y9p$,=P$k$,=hM}<+e(B
|e$BBN$O$G$-$k$O$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i$$$,$;$$$<$$$G$O$J$$$+$H;W$$$^$9!#e(B

                            e$B$^$D$b$He(B e$B$f$-$R$me(B /:|)

#9

In article removed_email_address@domain.invalid,
Urabe S. removed_email_address@domain.invalid writes:

semanticse$B$N$[$&$,J]B8$5$l$F$?$[$&$,$$$$$N$K$OG<F@$7$^$7$?$,!"?2ITB-$NF,e(B
e$B$G9M$($?$H$3$m$K$h$k$H!"$=$l$C$FL5M}$8$c$J$$e(B?

1.8e$B$He(B1.9e$B$O@55,I=8=%(%s%8%s$,0c$&$o$1$G!"$?$H$($Pe(B /(?bar)/ e$B$H$+$Oe(B1.8
e$B$K;}$C$F$$$/$3$H$O$G$-$^$;$s$h$M!#e(B

e$B$($’!#L5M}$J$3$H$O$"$j$^$9!#e(B

e$B$^$"$D$^$j!“7k6I$N$H$3$me(BMarshale$B%G!<%?$re(B1.8e$B$G:n$C$Fe(B1.9e$B$GFI$$N$O$R$g$C$He(B e$B$7$F4hD%$l$P2DG=$+$b$7$l$J$$$1$I!"e(B1.9e$B$G:n$C$Fe(B1.8e$B$GFI$$N$O$”$+$i$5$^$KITe(B
e$B2DG=$J$N$G!“4hD%$l$k$K$7$F$b>e0L8_49$/$i$$$,4X$N;3$G!”$C$F$3$H$Oe(BMarshal
e$B$N%P!<%8%g%s$,F1$8$G$"$k$3$H$K8G<9$7$F$b0UL#$J$$$s$8$c$J$$$+$H$$$&5$$,$7e(B
e$B$F$-$?$s$G$9$,!"$I$&$G$7$g$&!#e(B

e$B%P!<%8%g%s$r$"$2$k$He(B drb e$B$Oe(B 1.8, 1.9
e$B4V$GF0$+$J$/$J$C$A$c$$$^$9$1$I$M$’!#e(B


#10

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:36785] Re: [Bug #650] Marshal.load raises
RegexpError”
on Sun, 19 Oct 2008 02:13:16 +0900, Urabe S.
removed_email_address@domain.invalid writes:

|Yukihiro M. e$B$5$s$O=q$-$^$7$?e(B:
|> (1) e$B<];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(B(e$B$Ge(Bklass==rb_cRegexp)e$B$Oe(B1.9e$B$Ne(BRegexp
e$B$H$$$&3d$H4JC1$JH=Dj$G$$$1$=$&$J5$$,$9$k$s$G$9$,!#e(B

e$B$*$b$$$D$-%l%Y%k$@$1$I!#e(B


#14

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:36794] Re: [Bug #650] Marshal.load raises
RegexpError”
on Mon, 20 Oct 2008 01:50:06 +0900, Urabe S.
removed_email_address@domain.invalid writes:

|e$B!Ve(B1.8e$B$+$iMh$?@55,I=8=$Ke(B\ue$B$,4^$^$l$F$$$?$ie(B1.9e$B$G$Oe(Bue$B$N$3$H$H$7$F07$&!W$G$$e(B
|e$B$$$s$8$c$J$$$G$9$+$M!#e(B
|1.8e$B$,e(B1.9e$B$+$iMh$k@55,I=8=$rFI$a$k$h$&$K$J$k$3$H$O4|BT$7$F$^$;$s!#e(B

|undocumentede$B$J$N$,M}M3$K$J$l$k$N$O$A$c$s$H%I%-%e%a%s%H$,$"$k$H$-$@$1$G$Ke(B
|e$B$7$^$7$g$&$M!#e(B
|e$B$?$H$($Pe(B/\n/e$B$de(B/\t/e$B$"$?$j$b%I%-%e%a%s%H$5$l$F$^$;$s$1$I!"$^$5$+:#8e$NF0:ne(B
|e$B$rJ]>Z$7$J$$$H$+8@$$=P$7$^$9$+e(B?

e$B$"!<!"$G$O!V0UL#!W$H!V0U?^!W$H8@$$49$($^$7$g$&!#e(B\ne$B$de(B\te$B$,$I$Ne(B
e$B$h$&$J0UL#$r;}$D$+$K$D$$$F!"$[$H$s$I$N?M$O0lDj$N4|BT$r;}$D$Ge(B
e$B$7$g$&$7!"$=$l$K1~$($k$D$b$j$O==J,$K$"$j$^$9!#$7$+$7!“0lJ}!“e(B
\ue$B$O$I$&$G$7$g$&!)e(B
e$B$3$l$K$?$$$7$F$[$H$s$I$N?M$,9g0U$G$-$k0UL#e(B
e$B$OB8:_$7$J$$$H;W$$$^$9!#85$N@55,I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$7$J$$!W$r$I$s$I$sB3$1$F$$$/$H!”:G=E$K$OFI$a$J$$e(BDBe$B$7$+;D$i$Je(B
|e$B$/$J$k$G$7$g$&e(B(e$B$5$9$,$K$=$3$^$GE~C#$9$kA0$K$J$s$+2sHr:v$O9M$($k$3$H$K$Je(B
|e$B$k$H;W$$$^$9$,e(B)e$B!#e(B
|
|e$B$;$a$F2a5n$N%P!<%8%g%s$GFI$a$F$$$?%G!<%?$O<h$j=P$;$k$Y$-$G$9!#e(B

e$BL5>r7o$G!)e(B e$B:#2s$N>l9g$O%P!<%8%g%s$,?J$s$@$*$+$2$G%P%0$,8+$De(B
e$B$+$C$?$N$@$H;d$K$O8+$($^$9$1$I!#e(B

                            e$B$^$D$b$He(B e$B$f$-$R$me(B /:|)

#15

e$B$b$H$N@55,I=8=$K%P%0$,$"$k$N$OG’$a$^$9$,!"$=$l$K4,$-9~$^$l$F$G$+$$e(BPStore
e$B$N%G!<%?$,$^$k$4$HFI$a$J$/$F:$$C$F$k$s$G$9$C$F$P!#e(B

e$B$8$c$"BE6(0F$G$9$1$I!"e(BMarshal.loade$B$Ke(B invalid: :replace
e$B$H$+<u$1<h$l$k$he(B
e$B$&$K$7$^$;$se(B?

Yukihiro M. e$B$5$s$O=q$-$^$7$?e(B:


#16

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:36830] Re: [Bug #650] Marshal.load raises
RegexpError”
on Tue, 21 Oct 2008 12:37:17 +0900, Urabe S.
removed_email_address@domain.invalid writes:

|e$B$b$H$N@55,I=8=$K%P%0$,$"$k$N$OG’$a$^$9$,!"$=$l$K4,$-9~$^$l$F$G$+$$e(BPStore
|e$B$N%G!<%?$,$^$k$4$HFI$a$J$/$F:$$C$F$k$s$G$9$C$F$P!#e(B

e$BJL$K0UCO0-$r8@$C$F$k$o$1$G$O$J$$$s$G$9$,!#e(B
loade$B$KEO$9e(Bproce$B$,;H$($k$+!"$H0l=V;W$C$?$N$G$9$,!"$3$l$O:F@8$7e(B
e$B$?%*%V%8%’%/%H$r0z?t$K$9$k$N$G:F@8$=$N$b$N$,<:GT$9$k:#2s$N%1!<e(B
e$B%9$O;H$($^$;$s$M$(!#e(B

|e$B$8$c$"BE6(0F$G$9$1$I!"e(BMarshal.loade$B$Ke(B invalid: :replace e$B$H$+<u$1<h$l$k$he(B
|e$B$&$K$7$^$;$se(B?

e$B4pK\E*$K$O$$$$%"%$%G%#%"$@$H;W$$$^$9!#$3$N>l9g!"e(BAPIe$B$Oe(B

Marshal.load(src, invalid: :replace)

e$B$H$+$K$9$k$s$G$9$+$M!#$=$N>l9g!":F@8$K<:GT$7$?%*%V%8%’%/%H$Oe(B
e$B$J$K$KCV49$7$?$i$h$$$N$G$7$g$&$+!#e(Bnile$B!)e(B

                            e$B$^$D$b$He(B e$B$f$-$R$me(B /:|)

#17

e$B@>;3OB9-$G$9!#e(B

At Tue, 21 Oct 2008 16:30:57 +0900,
Urabe S. wrote:

Objecte$B$N%$%s%9%?%s%9$re(BMarshal.load(Marshal.dump)e$B$7$?$b$N$O$b$H$N%$%s%9%?e(B
e$B%s%9$H$Oe(B==e$B$K$J$i$J$$$+$i$3$l$GLdBj$J$$$H$*$b$$$^$9!#e(B

drubye$B$N>l9g$Oe(BMarshal.loade$B$K<:GT$7$?$H$-$K!"Nc30$H85$N%G!<%?$r;}$C$?e(B
DRbUnknowne$B%%V%8%’%/%H$K$J$k$N$G!"F1$8$h$&$KM}M3$HFI$_9~$a$J$+$C$?%G!<%?$re(B
e$B;}$D%
%V%8%’%/%H$K$9$k$N$O$I$&$G$7$g$&$+e(B?


#18

e$BKNIt$G$9!#e(B

Yukihiro M. e$B$5$s$O=q$-$^$7$?e(B:

|e$B$8$c$"BE6(0F$G$9$1$I!"e(BMarshal.loade$B$Ke(B invalid: :replace e$B$H$+<u$1<h$l$k$he(B
|e$B$&$K$7$^$;$se(B?

e$B4pK\E*$K$O$$$$%"%$%G%#%"$@$H;W$$$^$9!#$3$N>l9g!"e(BAPIe$B$Oe(B

Marshal.load(src, invalid: :replace)

e$B$H$+$K$9$k$s$G$9$+$M!#$=$N>l9g!":F@8$K<:GT$7$?%*%V%8%’%/%H$Oe(B
e$B$J$K$KCV49$7$?$i$h$$$N$G$7$g$&$+!#e(Bnile$B!)e(B

e$B%f!<%6!<%"%W%j%1!<%7%g%sB&$OJQ49$K<:GT$7$?$+$I$&$+$re(B==e$B$GH=Dj$9$k$H$*$b$oe(B
e$B$l$k$N$G!"e(Bnile$B$_$?$$$J$b$N$h$j$bIaDL$Ne(BObject.newe$B$N$[$&$,$$$$$s$8$c$J$$$Ge(B
e$B$7$g$&$+!#e(B

rb_define_const(rb_mMarshal, “Invalid”, rb_obj_alloc(rb_cObject);

obj = Marshal.load src, invalid: :replace
obj == Marshal::Invalid and raise “invalid data”

Objecte$B$N%$%s%9%?%s%9$re(BMarshal.load(Marshal.dump)e$B$7$?$b$N$O$b$H$N%$%s%9%?e(B
e$B%s%9$H$Oe(B==e$B$K$J$i$J$$$+$i$3$l$GLdBj$J$$$H$*$b$$$^$9!#e(B


#19

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:36836] Re: [Bug #650] Marshal.load raises
RegexpError”
on Tue, 21 Oct 2008 16:30:57 +0900, Urabe S.
removed_email_address@domain.invalid writes:

|e$B%f!<%6!<%"%W%j%1!<%7%g%sB&$OJQ49$K<:GT$7$?$+$I$&$+$re(B==e$B$GH=Dj$9$k$H$$b$oe(B
|e$B$l$k$N$G!"e(Bnile$B$_$?$$$J$b$N$h$j$bIaDL$Ne(BObject.newe$B$N$[$&$,$$$$$s$8$c$J$$$Ge(B
|e$B$7$g$&$+!#e(B
|
| # rb_define_const(rb_mMarshal, “Invalid”, rb_obj_alloc(rb_cObject);
| obj = Marshal.load src, invalid: :replace
| obj == Marshal::Invalid and raise “invalid data”
|
|Objecte$B$N%$%s%9%?%s%9$re(BMarshal.load(Marshal.dump)e$B$7$?$b$N$O$b$H$N%$%s%9%?e(B
|e$B%s%9$H$Oe(B==e$B$K$J$i$J$$$+$i$3$l$GLdBj$J$$$H$
$b$$$^$9!#e(B

e$B$U$`!#$3$N@~$GBP1~$7$h$&$+$J$H;W$&$N$G$9$,!"$^$@$b$&>/$7$D$ae(B
e$B$-$l$F$$$J$$5$$,$7$^$9!#0J2<$K$$$m$$$m$H9M$($r=q$-O"$M$F$*$-e(B
e$B$^$9$N$G!“0U8+$,$”$l$PJ9$+$;$F$/$@$5$$!#e(B

  • e$B%*%V%8%’%/%H:F@8;~$KNc30$,H/@8$7$?$ie(BObject.newe$B$KCV$-49$(e(B
    e$B$k5sF0$O%G%U%)%k%H$+!)e(B
  • e$B@Z$jBX$(2DG=$+e(B(e$B$$$D$bCV$-49$($F$O$$$1$J$$$+e(B)
  • Object.newe$B$K$O$I$N$h$&$J>pJs$r;}$?$9$Y$-$+e(B
    • e$BFCDj$N%^!<%+!<$K$J$k%*%V%8%’%/%He(B(e$B;H$$$^$o$9e(B)
    • e$BC1$Ke(BObject.new
    • e$BFCDj$N%/%i%9e(B(or Struct)e$B$N%$%s%9%?%s%9e(B
      • e$BNc30$d<:GT$7$?I|85>pJs$r4^$`!)e(B

e$B$$$m$$$mFq$7$$$b$N$@!#e(B

                            e$B$^$D$b$He(B e$B$f$-$R$me(B /:|)

#20

e$B$1$$$8$e!w$$$7$D$+$G$9e(B.

In [ruby-dev :36863 ] the message: "[ruby-dev:36863] Re: [Bug #650]
Marshal.load raises RegexpError ", on Oct/22 17:37(JST) Yukihiro
Matsumoto writes:

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

e$B$U$`!#$3$N@~$GBP1~$7$h$&$+$J$H;W$&$N$G$9$,!"$^$@$b$&>/$7$D$ae(B
e$B$-$l$F$$$J$$5$$,$7$^$9!#0J2<$K$$$m$$$m$H9M$($r=q$-O"$M$F$*$-e(B
e$B$^$9$N$G!“0U8+$,$”$l$PJ9$+$;$F$/$@$5$$!#e(B

e$B;d$O@>;3$5$s$Ne(B:

drubye$B$N>l9g$Oe(BMarshal.loade$B$K<:GT$7$?$H$-$K!"Nc30$H85$N%G!<%?$r;}$C$?e(B
DRbUnknowne$B%%V%8%’%/%H$K$J$k$N$G!"F1$8$h$&$KM}M3$HFI$_9~$a$J$+$C$?%G!<%?$re(B
e$B;}$D%
%V%8%’%/%H$K$9$k$N$O$I$&$G$7$g$&$+e(B?

e$B$NJ}$,NI$$5$$,$7$^$9e(B.

e$BNc$($Pe(B, e$BG[Ns$N0lMWAG$,I|85$G$-$J$+$C$?>l9g$J$Ie(B,
e$BJ#?t$N%*%V%8%’%/%H$r:Fe(B
e$B@8$7$?$H$-e(B,

obj = Marshal.load src, invalid: :replace
obj == Marshal::Invalid and raise “invalid data”

e$B$3$N$d$jJ}$G$Oe(B,
e$B<B:]$K$I$N%%V%8%’%/%H$N:F@8$K<:GT$7$?$N$+D4$Y$k$N$,Fqe(B
e$B$7$$$H;W$$$^$9e(B. e$B$^$:Nc30$rH/@8$5$;$Fe(B,
e$B:F@8$G$-$J$+$C$?$3$H$rL@<(E
$KCNe(B
e$B$i$;$Fe(B, e$B$G$O$I$3$,$*$+$7$$$N$+$Je(B?
e$B$C$FCf?H$rD4$Y$i$l$kJ}$,$h$$$N$G$Oe(B?

e$B$"$He(B, e$B$3$NJ}K!$@$He(B,
e$B%*%W%7%g%s$N;XDj$bI,MW$J$$$h$&$J5$$,$7$^$9e(B. e$B>o$K%^!<e(B
e$B%+!<$KCV$-49$($A$c$($PNI$$$N$Ge(B.

__
---------------------------------------------------->> e$B@PDMe(B
e$B7=<ye(B <<—
---------------------------------->> e-mail: removed_email_address@domain.invalid <<—