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.
This commit is contained in:
Daniel Richard G. 2026-03-05 17:41:05 -05:00 committed by Ralph Sennhauser
parent eab11c247c
commit 4050c645ac

View file

@ -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;
}