summaryrefslogtreecommitdiff
path: root/meta/recipes-devtools/perl/perl-5.12.2/debian/fixes/concat-stack-corruption.diff
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/perl/perl-5.12.2/debian/fixes/concat-stack-corruption.diff')
-rw-r--r--meta/recipes-devtools/perl/perl-5.12.2/debian/fixes/concat-stack-corruption.diff37
1 files changed, 37 insertions, 0 deletions
diff --git a/meta/recipes-devtools/perl/perl-5.12.2/debian/fixes/concat-stack-corruption.diff b/meta/recipes-devtools/perl/perl-5.12.2/debian/fixes/concat-stack-corruption.diff
new file mode 100644
index 000000000..6feb8401f
--- /dev/null
+++ b/meta/recipes-devtools/perl/perl-5.12.2/debian/fixes/concat-stack-corruption.diff
@@ -0,0 +1,37 @@
+From: Niko Tyni <ntyni@debian.org>
+Subject: Fix stack pointer corruption in pp_concat() with 'use encoding'
+Bug-Debian: http://bugs.debian.org/596105
+Bug: http://rt.perl.org/rt3/Ticket/Display.html?id=78674
+Origin: upstream, http://perl5.git.perl.org/perl.git/commit/e3393f51d48d8b790e26324eb0336fac9689fa46
+
+If the stack is reallocated during pp_concat() and 'use encoding' in
+effect, the stack pointer gets corrupted, causing memory allocation bugs
+and the like.
+
+---
+ pp_hot.c | 3 +++
+ 1 files changed, 3 insertions(+), 0 deletions(-)
+
+diff --git a/pp_hot.c b/pp_hot.c
+index 3371e88..e9cccf3 100644
+--- a/pp_hot.c
++++ b/pp_hot.c
+@@ -271,6 +271,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 {
+@@ -279,6 +281,7 @@ PP(pp_concat)
+ sv_utf8_upgrade_nomg(right);
+ rpv = SvPV_const(right, rlen);
+ }
++ SPAGAIN;
+ }
+ sv_catpvn_nomg(TARG, rpv, rlen);
+
+--
+tg: (c823880..) fixes/concat-stack-corruption (depends on: upstream)