perl/perl-5.33.0-XSUB.h-fix-MARK-and-items-variables-inside-BOOT-XSUB.patch

46 lines
1.5 KiB
Diff

From 313464947382fab07299af0061f419a55540356a Mon Sep 17 00:00:00 2001
From: Tomasz Konojacki <me@xenu.pl>
Date: Mon, 27 Apr 2020 08:31:47 +0200
Subject: [PATCH] XSUB.h: fix MARK and items variables inside BOOT XSUBs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
ax was incremented by Perl_xs_handshake() and because of that
MARK and items were off by one inside BOOT XSUBs.
fixes #17755
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
XSUB.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/XSUB.h b/XSUB.h
index e3147ce9fb..5f17a5acde 100644
--- a/XSUB.h
+++ b/XSUB.h
@@ -160,16 +160,16 @@ is a lexical C<$_> in scope.
PL_xsubfilename. */
#define dXSBOOTARGSXSAPIVERCHK \
I32 ax = XS_BOTHVERSION_SETXSUBFN_POPMARK_BOOTCHECK; \
- SV **mark = PL_stack_base + ax; dSP; dITEMS
+ SV **mark = PL_stack_base + ax - 1; dSP; dITEMS
#define dXSBOOTARGSAPIVERCHK \
I32 ax = XS_APIVERSION_SETXSUBFN_POPMARK_BOOTCHECK; \
- SV **mark = PL_stack_base + ax; dSP; dITEMS
+ SV **mark = PL_stack_base + ax - 1; dSP; dITEMS
/* dXSBOOTARGSNOVERCHK has no API in xsubpp to choose it so do
#undef dXSBOOTARGSXSAPIVERCHK
#define dXSBOOTARGSXSAPIVERCHK dXSBOOTARGSNOVERCHK */
#define dXSBOOTARGSNOVERCHK \
I32 ax = XS_SETXSUBFN_POPMARK; \
- SV **mark = PL_stack_base + ax; dSP; dITEMS
+ SV **mark = PL_stack_base + ax - 1; dSP; dITEMS
#define dXSTARG SV * const targ = ((PL_op->op_private & OPpENTERSUB_HASTARG) \
? PAD_SV(PL_op->op_targ) : sv_newmortal())
--
2.25.4