diff options
author | David Mitchell <davem@iabyn.com> | 2010-06-23 00:23:24 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2010-07-03 16:25:58 +0100 |
commit | 3e5c01898a8b319439f67ce035bfc80fb80b4f3b (patch) | |
tree | d08ac57600b29264ce02c1600f3b1094130a62ea /toke.c | |
parent | a02ec77af3235fc3d744725d93fbef7d9126695a (diff) | |
download | perl-3e5c01898a8b319439f67ce035bfc80fb80b4f3b.tar.gz |
eval $overloaded can crash
Perl_lex_start() assumes that the SV passed to it is a well-behaved
string that it can do PVX() stuff to. If it's actually a ref to an
overloaded object, it can crash and burn. Fixed by creating a stringified
copy of the SV if necessary.
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -714,8 +714,9 @@ Perl_lex_start(pTHX_ SV *line, PerlIO *rsfp, bool new_filter) if (!len) { parser->linestr = newSVpvs("\n;"); - } else if (SvREADONLY(line) || s[len-1] != ';') { - parser->linestr = newSVsv(line); + } else if (SvREADONLY(line) || s[len-1] != ';' || !SvPOK(line)) { + parser->linestr = newSV_type(SVt_PV); + sv_copypv(parser->linestr, line); /* avoid tie/overload weirdness */ if (s[len-1] != ';') sv_catpvs(parser->linestr, "\n;"); } else { |