From e3393f51d48d8b790e26324eb0336fac9689fa46 Mon Sep 17 00:00:00 2001 From: Niko Tyni Date: Thu, 28 Oct 2010 23:52:17 +0300 Subject: [PATCH] [perl #78674] Fix stack pointer corruption in pp_concat() with 'use encoding' sv_utf8_upgrade_nomg() may reallocate the stack via sv_recode_to_utf8() if 'use encoding' is in effect, causing stack pointer corruption. --- pp_hot.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pp_hot.c b/pp_hot.c index fd270e9798..f4d79dc5da 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -275,6 +275,8 @@ PP(pp_concat) rbyte = !DO_UTF8(right); } if (lbyte != rbyte) { + /* sv_utf8_upgrade_nomg() may reallocate the stack */ + PUTBACK; if (lbyte) sv_utf8_upgrade_nomg(TARG); else { @@ -283,6 +285,7 @@ PP(pp_concat) sv_utf8_upgrade_nomg(right); rpv = SvPV_nomg_const(right, rlen); } + SPAGAIN; } sv_catpvn_nomg(TARG, rpv, rlen); -- 2.34.1