summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-10-08 04:15:29 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-10-08 04:15:29 +0000
commit9a2031270d44204ce5f6c2c6c8bb52d0df0b6911 (patch)
tree6c7d350676c43367dc981b08deaf9e8bd89b980f /pp_ctl.c
parent45d2de233d283040e1a0f6bad0ab22425d1e8b6d (diff)
downloadperl-9a2031270d44204ce5f6c2c6c8bb52d0df0b6911.tar.gz
save_re_context() could reset PL_curcop to freed memory, causing core
dumps in code such as C<use CGI::Carp; use something_that_calls_die;> p4raw-id: //depot/perl@7165
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index c949e789a1..d69aaa8a96 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1417,6 +1417,12 @@ Perl_die_where(pTHX_ char *message, STRLEN msglen)
LEAVE;
+ /* LEAVE could clobber PL_curcop (see save_re_context())
+ * XXX it might be better to find a way to avoid messing with
+ * PL_curcop in save_re_context() instead, but this is a more
+ * minimal fix --GSAR */
+ PL_curcop = cx->blk_oldcop;
+
if (optype == OP_REQUIRE) {
char* msg = SvPVx(ERRSV, n_a);
DIE(aTHX_ "%sCompilation failed in require",