diff options
author | Tony Cook <tony@develop-help.com> | 2019-08-05 15:23:45 +1000 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2019-08-08 13:57:52 +1000 |
commit | 933e3e630076d4fdbe32a101eeb5f12e37ec4ac2 (patch) | |
tree | 6860602ccad0a14cdebee66674b12b01a7731a69 /pp_ctl.c | |
parent | 134b625d9892c96a2e9718d6dba0692b40391bc7 (diff) | |
download | perl-933e3e630076d4fdbe32a101eeb5f12e37ec4ac2.tar.gz |
(perl #134266) make sure $@ is writable when we write to it
when unwinding.
Since except_sv might be ERRSV we try to preserve it's value,
if not the actual SV (which we have an extra refcount on if it is
except_sv).
Diffstat (limited to 'pp_ctl.c')
-rw-r--r-- | pp_ctl.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -1724,9 +1724,13 @@ Perl_die_unwind(pTHX_ SV *msv) * perls 5.13.{1..7} which had late setting of $@ without this * early-setting hack. */ - if (!(in_eval & EVAL_KEEPERR)) + if (!(in_eval & EVAL_KEEPERR)) { + /* remove any read-only/magic from the SV, so we don't + get infinite recursion when setting ERRSV */ + SANE_ERRSV(); sv_setsv_flags(ERRSV, exceptsv, (SV_GMAGIC|SV_DO_COW_SVSETSV|SV_NOSTEAL)); + } if (in_eval & EVAL_KEEPERR) { Perl_ck_warner(aTHX_ packWARN(WARN_MISC), "\t(in cleanup) %" SVf, @@ -1788,8 +1792,10 @@ Perl_die_unwind(pTHX_ SV *msv) */ S_pop_eval_context_maybe_croak(aTHX_ cx, exceptsv, 2); - if (!(in_eval & EVAL_KEEPERR)) + if (!(in_eval & EVAL_KEEPERR)) { + SANE_ERRSV(); sv_setsv(ERRSV, exceptsv); + } PL_restartjmpenv = restartjmpenv; PL_restartop = restartop; JMPENV_JUMP(3); |