[Scummvm-git-logs] scummvm master -> 980b693a6cc57a9aa4cc0eb9a651ed4949981b87

bluegr noreply at scummvm.org
Tue Jun 7 04:37:35 UTC 2022


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:
980b693a6c TOLTECS: Fix unaligned access in Screen::addAnimatedSprite()


Commit: 980b693a6cc57a9aa4cc0eb9a651ed4949981b87
    https://github.com/scummvm/scummvm/commit/980b693a6cc57a9aa4cc0eb9a651ed4949981b87
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2022-06-07T07:37:32+03:00

Commit Message:
TOLTECS: Fix unaligned access in Screen::addAnimatedSprite()

Use READ_LE_UINT16 instead of FROM_LE_16 to avoid unaligned memory
access, as seen on OpenBSD/loongson (mips64el) where it would SIGBUS
when trying to play the demo.

Changed paths:
    engines/toltecs/screen.cpp


diff --git a/engines/toltecs/screen.cpp b/engines/toltecs/screen.cpp
index b00f8a11787..2a2bf1c2efa 100644
--- a/engines/toltecs/screen.cpp
+++ b/engines/toltecs/screen.cpp
@@ -209,13 +209,13 @@ void Screen::addAnimatedSprite(int16 x, int16 y, int16 fragmentId, byte *data, i
 		drawRequest.scaling = 0;
 	}
 
-	int16 count = FROM_LE_16(spriteArray[0]);
+	int16 count = READ_LE_UINT16(&spriteArray[0]);
 
 	//debug(0, "count = %d", count);
 
 	for (int16 index = 1; index <= count; index++) {
 
-		byte *spriteItem = data + FROM_LE_16(spriteArray[index]);
+		byte *spriteItem = data + READ_LE_UINT16(&spriteArray[index]);
 
 		uint16 loopNum = READ_LE_UINT16(spriteItem + 0) & 0x7FFF;
 		uint16 loopCount = READ_LE_UINT16(spriteItem + 2);




More information about the Scummvm-git-logs mailing list