dev-lang/mono: fix build on arm64; backport UB fix

Closes: https://bugs.gentoo.org/960113
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Sam James
2026-04-14 11:54:44 +01:00
parent 16b26875d3
commit 507222c459
3 changed files with 61 additions and 0 deletions
@@ -0,0 +1,31 @@
https://bugs.gentoo.org/960113
https://gitlab.winehq.org/mono/mono/-/commit/2224c6915a98f870cc9a3a9f9e3698e7b20e3d27
From 2224c6915a98f870cc9a3a9f9e3698e7b20e3d27 Mon Sep 17 00:00:00 2001
From: Esme Povirk <esme@codeweavers.com>
Date: Sat, 12 Apr 2025 20:31:54 +0000
Subject: [PATCH] arm64: Fix a pointer-to-int cast size mismatch.
---
mono/utils/mono-sigcontext.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/mono/utils/mono-sigcontext.h b/mono/utils/mono-sigcontext.h
index 2153c1cad57..6426f44b7c7 100644
--- a/mono/utils/mono-sigcontext.h
+++ b/mono/utils/mono-sigcontext.h
@@ -492,6 +492,12 @@ typedef struct ucontext {
#define UCONTEXT_REG_SP(ctx) (((ucontext_t*)(ctx))->uc_mcontext.sp)
#define UCONTEXT_REG_R0(ctx) (((ucontext_t*)(ctx))->uc_mcontext.regs [ARMREG_R0])
#define UCONTEXT_GREGS(ctx) (&(((ucontext_t*)(ctx))->uc_mcontext.regs))
+ #define UCONTEXT_REG_SET_PC(ctx, val) do { \
+ UCONTEXT_REG_PC (ctx) = (gsize)(val); \
+ } while (0)
+ #define UCONTEXT_REG_SET_SP(ctx, val) do { \
+ UCONTEXT_REG_SP (ctx) = (val); \
+ } while (0)
#endif
#ifndef UCONTEXT_REG_SET_PC
--
GitLab
@@ -0,0 +1,28 @@
https://gitlab.winehq.org/mono/mono/-/commit/dee6acaeb59e46661efd4ca2018cdd1c275d2a09
From dee6acaeb59e46661efd4ca2018cdd1c275d2a09 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bernhard=20=C3=9Cbelacker?= <bernhardu@mailbox.org>
Date: Wed, 3 Sep 2025 22:28:13 +0200
Subject: [PATCH] Avoid strcpy on overlapping strings in mono_path_canonicalize
(ASan).
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57691
---
mono/utils/mono-path.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mono/utils/mono-path.c b/mono/utils/mono-path.c
index 2f4790666a4..a9924732902 100644
--- a/mono/utils/mono-path.c
+++ b/mono/utils/mono-path.c
@@ -87,7 +87,7 @@ mono_path_canonicalize (const char *path)
lastpos = lastpos-1;
#endif
- if (dest != lastpos) strcpy (dest, lastpos);
+ if (dest != lastpos) memmove (dest, lastpos, strlen(lastpos) + 1);
g_strreverse (abspath);
--
GitLab
@@ -39,6 +39,8 @@ BDEPEND="
PATCHES=(
"${FILESDIR}"/${PN}-6.14.1-disable-automagic-ccache.patch
"${FILESDIR}"/${PN}-6.12.0.199-configure-c99.patch
"${FILESDIR}"/${PN}-6.14.1-c99-arm64.patch
"${FILESDIR}"/${PN}-6.14.1-strcpy-overlap.patch
)
pkg_pretend() {