[Scummvm-git-logs] scummvm master -> 3c3d35dafe44bd705ee05d9e5959cd1165c9d2c5
sev-
sev at scummvm.org
Sat Aug 1 12:16:44 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
3c3d35dafe AGOS: Fix compatibility with strict-alignment architectures
Commit: 3c3d35dafe44bd705ee05d9e5959cd1165c9d2c5
https://github.com/scummvm/scummvm/commit/3c3d35dafe44bd705ee05d9e5959cd1165c9d2c5
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2020-08-01T14:16:40+02:00
Commit Message:
AGOS: Fix compatibility with strict-alignment architectures
Make sure that alignTableMem() always aligns to an 8 byte boundary
on 64-bit architectures where this is the usual size of pointers.
Also make sure that loadTextIntoMem() always calls alignTableMem().
This has been tested on OpenBSD/loongson (a mips64el architecture which requires
strict alignment), with clang++ 8.0.1 and simon2-cd-fr.
Fixes bug #6220.
Changed paths:
engines/agos/string.cpp
engines/agos/subroutine.cpp
diff --git a/engines/agos/string.cpp b/engines/agos/string.cpp
index d2f7ac6bd5..036ee5683a 100644
--- a/engines/agos/string.cpp
+++ b/engines/agos/string.cpp
@@ -332,6 +332,7 @@ void AGOSEngine::loadTextIntoMem(uint16 stringId) {
_tablesHeapPtr += size;
_tablesHeapCurPos += size;
+ alignTableMem();
if (_tablesHeapCurPos > _tablesHeapSize) {
error("loadTextIntoMem: Out of table memory");
diff --git a/engines/agos/subroutine.cpp b/engines/agos/subroutine.cpp
index 2aedfa26fa..eaa080f6bf 100644
--- a/engines/agos/subroutine.cpp
+++ b/engines/agos/subroutine.cpp
@@ -218,9 +218,9 @@ Subroutine *AGOSEngine::getSubroutineByID(uint subroutineId) {
}
void AGOSEngine::alignTableMem() {
- if (!IS_ALIGNED(_tablesHeapPtr, 4)) {
- _tablesHeapPtr += 2;
- _tablesHeapCurPos += 2;
+ while (!IS_ALIGNED(_tablesHeapPtr, sizeof(byte *))) {
+ _tablesHeapPtr++;
+ _tablesHeapCurPos++;
}
}
More information about the Scummvm-git-logs
mailing list