[Scummvm-git-logs] scummvm master -> e6e6a40ebf9c7fc3ecd77c0a4198ba9e8550e839

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


Commit: e6e6a40ebf9c7fc3ecd77c0a4198ba9e8550e839
    https://github.com/scummvm/scummvm/commit/e6e6a40ebf9c7fc3ecd77c0a4198ba9e8550e839
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2024-12-01T17:10:50+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