summaryrefslogtreecommitdiff
path: root/scope.h
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2004-07-02 01:49:11 +0000
committerDave Mitchell <davem@fdisolutions.com>2004-07-02 01:49:11 +0000
commit8b7059b1a993d7ac934442e99623d9dbc5fe3ce8 (patch)
tree7103d4613a669489d661dc301f5e71e1f13f4129 /scope.h
parent6f980a54574e0bf71b1f27e663d5e95cbb8a2612 (diff)
downloadperl-8b7059b1a993d7ac934442e99623d9dbc5fe3ce8.tar.gz
[perl #30258] utf8 POPSTACK crash on split execution
split() does a SWITCHSTACK to directly split to an array, but if it subsequently dies (eg the regex triggers a 'use utf8' which is then denied by Safe), then the switch doesn't get undone. Add a new save type to allow for this. p4raw-id: //depot/perl@23023
Diffstat (limited to 'scope.h')
-rw-r--r--scope.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/scope.h b/scope.h
index bbb55628fe..f86039dbd1 100644
--- a/scope.h
+++ b/scope.h
@@ -48,6 +48,7 @@
#define SAVEt_SHARED_PVREF 37
#define SAVEt_BOOL 38
#define SAVEt_SET_SVFLAGS 39
+#define SAVEt_SAVESWITCHSTACK 40
#ifndef SCOPE_SAVES_SIGNAL_MASK
#define SCOPE_SAVES_SIGNAL_MASK 0
@@ -169,6 +170,16 @@ Closing bracket on a callback. See C<ENTER> and L<perlcall>.
SSPUSHINT(SAVEt_COMPPAD); \
} STMT_END
+#define SAVESWITCHSTACK(f,t) \
+ STMT_START { \
+ SSCHECK(3); \
+ SSPUSHPTR((SV*)(f)); \
+ SSPUSHPTR((SV*)(t)); \
+ SSPUSHINT(SAVEt_SAVESWITCHSTACK); \
+ SWITCHSTACK((f),(t)); \
+ PL_curstackinfo->si_stack = (t); \
+ } STMT_END
+
#ifdef USE_ITHREADS
# define SAVECOPSTASH(c) SAVEPPTR(CopSTASHPV(c))
# define SAVECOPSTASH_FREE(c) SAVESHAREDPV(CopSTASHPV(c))