summaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2005-03-26 21:25:47 +0000
committerDave Mitchell <davem@fdisolutions.com>2005-03-26 21:25:47 +0000
commit96ca9f552a246a04e9873c974fac21138f3acd66 (patch)
tree975ad0f38ecbdf0b5531b249845c4602bb560fd7 /utf8.c
parent1ef29b0ef2de54bf3c997c80d0645374658d5ef2 (diff)
downloadperl-96ca9f552a246a04e9873c974fac21138f3acd66.tar.gz
[perl #33185] UTF-8 string substitution corrupts memory
The implicit call of 'require utf8' triggered by code like "\x{100}" =~ /[[:print:]]/ wasn't saving state correctly first. p4raw-id: //depot/perl@24084
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/utf8.c b/utf8.c
index 6fc068040b..61e4432222 100644
--- a/utf8.c
+++ b/utf8.c
@@ -1578,6 +1578,11 @@ Perl_swash_init(pTHX_ const char* pkg, const char* name, SV *listsv, I32 minbits
HV *stash = gv_stashpvn(pkg, pkg_len, FALSE);
SV* errsv_save;
+ PUSHSTACKi(PERLSI_MAGIC);
+ ENTER;
+ SAVEI32(PL_hints);
+ PL_hints = 0;
+ save_re_context();
if (!gv_fetchmeth(stash, "SWASHNEW", 8, -1)) { /* demand load utf8 */
ENTER;
errsv_save = newSVsv(ERRSV);
@@ -1589,7 +1594,6 @@ Perl_swash_init(pTHX_ const char* pkg, const char* name, SV *listsv, I32 minbits
LEAVE;
}
SPAGAIN;
- PUSHSTACKi(PERLSI_MAGIC);
PUSHMARK(SP);
EXTEND(SP,5);
PUSHs(sv_2mortal(newSVpvn(pkg, pkg_len)));
@@ -1598,10 +1602,6 @@ Perl_swash_init(pTHX_ const char* pkg, const char* name, SV *listsv, I32 minbits
PUSHs(sv_2mortal(newSViv(minbits)));
PUSHs(sv_2mortal(newSViv(none)));
PUTBACK;
- ENTER;
- SAVEI32(PL_hints);
- PL_hints = 0;
- save_re_context();
if (IN_PERL_COMPILETIME) {
/* XXX ought to be handled by lex_start */
SAVEI32(PL_in_my);