summaryrefslogtreecommitdiff
path: root/t/op/eval.t
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2010-06-23 00:23:24 +0100
committerDavid Mitchell <davem@iabyn.com>2010-07-03 16:25:58 +0100
commit3e5c01898a8b319439f67ce035bfc80fb80b4f3b (patch)
treed08ac57600b29264ce02c1600f3b1094130a62ea /t/op/eval.t
parenta02ec77af3235fc3d744725d93fbef7d9126695a (diff)
downloadperl-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 't/op/eval.t')
-rw-r--r--t/op/eval.t9
1 files changed, 8 insertions, 1 deletions
diff --git a/t/op/eval.t b/t/op/eval.t
index ff5004eae5..0a5fadc1e0 100644
--- a/t/op/eval.t
+++ b/t/op/eval.t
@@ -6,7 +6,7 @@ BEGIN {
require './test.pl';
}
-print "1..106\n";
+print "1..107\n";
eval 'print "ok 1\n";';
@@ -604,3 +604,10 @@ eval q{ eval { + } };
print "ok\n";
EOP
+fresh_perl_is(<<'EOP', "ok\n", undef, 'assert fail on non-string in Perl_lex_start');
+use overload '""' => sub { '1;' };
+my $ov = bless [];
+eval $ov;
+print "ok\n";
+EOP
+