Subject: | call_pv() can reallocate the stack, but Member_mime_name() continues to use the old stack |
This is causing the crash in https://rt.perl.org/Ticket/Display.html?id=122873
I've attached a fix. This is also available as https://github.com/dankogai/p5-encode/pull/23
Tony
Subject: | 0001-SPAGAIN-after-call_pv-which-can-reallocate-the-perl-.patch |
From 5f0737ab20b7bd46cddaccdfff5a6f78b73f19e1 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Thu, 2 Oct 2014 11:05:03 +1000
Subject: [PATCH] SPAGAIN after call_pv(), which can reallocate the perl stack
---
Encode.xs | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Encode.xs b/Encode.xs
index 5ee4539..5e20c3d 100644
--- a/Encode.xs
+++ b/Encode.xs
@@ -686,6 +686,7 @@ CODE:
/* require_pv(PERLIO_FILENAME); */
eval_pv("require PerlIO::encoding", 0);
+ SPAGAIN;
if (SvTRUE(get_sv("@", 0))) {
ST(0) = &PL_sv_no;
@@ -703,6 +704,7 @@ CODE:
encode_t *enc = INT2PTR(encode_t *, SvIV(SvRV(obj)));
SV *retval;
eval_pv("require Encode::MIME::Name", 0);
+ SPAGAIN;
if (SvTRUE(get_sv("@", 0))) {
ST(0) = &PL_sv_undef;
--
1.7.10.4