[Scummvm-git-logs] scummvm branch-2-6 -> 277ad722b1a243bd69378725873666675be416b1

dwatteau noreply at scummvm.org
Tue Sep 27 15:38:38 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:
277ad722b1 TOLTECS: Fix unaligned access in Screen::addAnimatedSprite()


Commit: 277ad722b1a243bd69378725873666675be416b1
    https://github.com/scummvm/scummvm/commit/277ad722b1a243bd69378725873666675be416b1
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2022-09-27T17:37:12+02: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.

(cherry picked from commit 980b693a6cc57a9aa4cc0eb9a651ed4949981b87)

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