[Scummvm-git-logs] scummvm branch-2-9 -> cd552489e9b8a93b9df31960df54e12a537ed8a8

lephilousophe noreply at scummvm.org
Sun Dec 1 16:15:40 UTC 2024


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:
cd552489e9 WII: Avoid reading at null address when restoring mouse cursors


Commit: cd552489e9b8a93b9df31960df54e12a537ed8a8
    https://github.com/scummvm/scummvm/commit/cd552489e9b8a93b9df31960df54e12a537ed8a8
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2024-12-01T17:15:16+01:00

Commit Message:
WII: Avoid reading at null address when restoring mouse cursors

When the engine doesn't sepcify any cursor, an empty cursor is on the
stack.
When restoring it after displaying the virtual keyboard, if the game is
not CLUT8, the game and the cursor palette are nullptr.
In this case, clear the palette.

Changed paths:
    backends/platform/wii/osystem_gfx.cpp


diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp
index db28429475b..0808739922c 100644
--- a/backends/platform/wii/osystem_gfx.cpp
+++ b/backends/platform/wii/osystem_gfx.cpp
@@ -337,6 +337,12 @@ void OSystem_Wii::updateMousePalette() {
 	if (_texMouse.palette) {
 		if (!_cursorPaletteDisabled) {
 			memcpy(_texMouse.palette, _cursorPalette, 256 * 2);
+#ifdef USE_RGB_COLOR
+		} else if (_pfGame.bytesPerPixel != 1) {
+			// When restoring the palette, there may be cases where game doesn't have any palette
+			// In this case, clear the palette
+			memset(_texMouse.palette, 0, 256 * 2);
+#endif
 		} else {
 			memcpy(_texMouse.palette, _texGame.palette, 256 * 2);
 		}




More information about the Scummvm-git-logs mailing list