[Scummvm-git-logs] scummvm master -> ae3a8efb20a1a6a0fd0328ad6079e8b213b69938
phcoder
noreply at scummvm.org
Tue Jan 10 16:39:23 UTC 2023
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:
ae3a8efb20 KYRA: Fix alignment in "lifes" variable.
Commit: ae3a8efb20a1a6a0fd0328ad6079e8b213b69938
https://github.com/scummvm/scummvm/commit/ae3a8efb20a1a6a0fd0328ad6079e8b213b69938
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-01-10T17:38:55+01:00
Commit Message:
KYRA: Fix alignment in "lifes" variable.
Midi is 18 bytes which results in int being misaligned and leads to
an undefined behaviour on RISC.
Changed paths:
engines/kyra/sound/drivers/halestorm.cpp
diff --git a/engines/kyra/sound/drivers/halestorm.cpp b/engines/kyra/sound/drivers/halestorm.cpp
index 45ba3ffeca4..f8d6e831086 100644
--- a/engines/kyra/sound/drivers/halestorm.cpp
+++ b/engines/kyra/sound/drivers/halestorm.cpp
@@ -114,8 +114,9 @@ private:
}
}
uint8 *crtbuf() {
- uint8 *tptr = new uint8[len + sizeof(int)];
- lifes = (int*)(tptr + len);
+ uint32 uplen = (len + sizeof(int) - 1) & ~(sizeof(int) - 1);
+ uint8 *tptr = new uint8[uplen + sizeof(int)];
+ lifes = (int*)(tptr + uplen);
ptr = tptr;
*lifes = 1;
DEBUG_BUFFERS_COUNT++;
More information about the Scummvm-git-logs
mailing list