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