summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pp_ctl.c4
-rw-r--r--t/op/caller.t9
2 files changed, 11 insertions, 2 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index b4fd4dd699..b85728ba04 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1857,7 +1857,9 @@ PP(pp_caller)
if (CxTYPE(cx) == CXt_EVAL) {
/* eval STRING */
if (CxOLD_OP_TYPE(cx) == OP_ENTEREVAL) {
- PUSHs(cx->blk_eval.cur_text);
+ PUSHs(newSVpvn_flags(SvPVX(cx->blk_eval.cur_text),
+ SvCUR(cx->blk_eval.cur_text)-2,
+ SvUTF8(cx->blk_eval.cur_text)|SVs_TEMP));
PUSHs(&PL_sv_no);
}
/* require */
diff --git a/t/op/caller.t b/t/op/caller.t
index 09d33f3876..8c8c236289 100644
--- a/t/op/caller.t
+++ b/t/op/caller.t
@@ -5,7 +5,7 @@ BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
require './test.pl';
- plan( tests => 86 );
+ plan( tests => 88 );
}
my @c;
@@ -266,6 +266,13 @@ foo::bar
END
"No crash when freed stash is reused for PV with offset hack";
+is eval "(caller 0)[6]", "(caller 0)[6]",
+ 'eval text returned by caller does not include \n;';
+
+# PL_linestr should not be modifiable
+eval '"${;BEGIN{ ${\(caller 2)[6]} = *foo }}"';
+pass "no assertion failure after modifying eval text via caller";
+
$::testing_caller = 1;
do './op/caller.pl' or die $@;