From 4050c645ac577731e8a6c0723df7d74bfe49fcca Mon Sep 17 00:00:00 2001 From: "Daniel Richard G." Date: Thu, 5 Mar 2026 17:41:05 -0500 Subject: [PATCH] Avoid SIGBUS error in the MD5 implementation on ARMv7 (armhf) Encountered in the test-suite run. This is just a workaround; the implementation needs to be reworked/replaced to accommodate alignment-sensitive architectures. --- source/maths/MD5.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/maths/MD5.cpp b/source/maths/MD5.cpp index 0ec7cbd961..f5675e6e57 100644 --- a/source/maths/MD5.cpp +++ b/source/maths/MD5.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2010 Wildfire Games. +/* Copyright (C) 2026 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -56,7 +56,13 @@ void MD5::UpdateRest(const u8* data, size_t len) // Process whole chunks of the input while (len >= CHUNK_SIZE) { +#if defined(__ARM_ARCH_7A__) + // Avoid SIGBUS on alignment-sensitive architecture + memcpy(m_Buf, data, CHUNK_SIZE); + Transform((const u32*)m_Buf); +#else Transform((const u32*)data); // assumes little-endian; ignores alignment +#endif data += CHUNK_SIZE; len -= CHUNK_SIZE; }