[Scummvm-git-logs] scummvm master -> 4b6c65ccc24dcba7a62b5203714a5ac830891d1d

dreammaster noreply at scummvm.org
Sat Oct 10 05:56:31 UTC 2026


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
4b6c65ccc2 MADS: Fix some unaligned accesses in quote handling code


Commit: 4b6c65ccc24dcba7a62b5203714a5ac830891d1d
    https://github.com/scummvm/scummvm/commit/4b6c65ccc24dcba7a62b5203714a5ac830891d1d
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2026-10-09T19:56:27-10:00

Commit Message:
MADS: Fix some unaligned accesses in quote handling code

SIGBUSes would happen on mips64el when starting Rex Nebular, or when
using the 'quotes' command in the debugger.

Also reported by UBSan in standard builds.

Changed paths:
    engines/mads/console.cpp
    engines/mads/core/quote.cpp


diff --git a/engines/mads/console.cpp b/engines/mads/console.cpp
index 4166813143f..e6d640ed4c4 100644
--- a/engines/mads/console.cpp
+++ b/engines/mads/console.cpp
@@ -140,7 +140,7 @@ bool Console::cmdQuotes(int argc, const char **argv) {
 			for (search = marker; *search; search++)
 				;
 			search++;
-			int id = *((uint16 *)search);
+			int id = READ_UINT16(search);
 
 			if (quoteId == -1) {
 				debugPrintf("%d: %s\n", id, marker);
diff --git a/engines/mads/core/quote.cpp b/engines/mads/core/quote.cpp
index 0ac99917166..863c1f0a67c 100644
--- a/engines/mads/core/quote.cpp
+++ b/engines/mads/core/quote.cpp
@@ -96,7 +96,7 @@ char *quote_vload(int quote_id, va_list marker) {
 
 			Common::strcpy_s(pointer, QUOTE_MAX_LIST_LENGTH, quoteStr.c_str());
 			pointer += (mem_needed - 2);
-			*(uint16 *)(pointer) = list[now_finding];
+			WRITE_UINT16(pointer, list[now_finding]);
 			pointer += 2;
 			now_finding++;
 
@@ -140,7 +140,7 @@ char *quote_string(char *quote_list, int quote_id) {
 	for (marker = quote_list; *marker && (result == NULL); marker = search + 2) {
 		for (search = marker; *search; search++);
 		search++;
-		id = *((uint16 *)search);
+		id = READ_UINT16(search);
 		if (id == quote_id)
 			result = marker;
 	}




More information about the Scummvm-git-logs mailing list