[Scummvm-git-logs] scummvm master -> 6d82d40db6e5e798e758667b29bd87f5a8bba63d

sev- sev at scummvm.org
Mon May 10 11:58:45 UTC 2021


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

Summary:
6dcf0939bf SLUDGE: Fix potential buffer overrun
77bfebb317 SLUDGE: Fix potential NULL dereference
84cc106cc5 SLUDGE: Plug memory leak
6d82d40db6 GRAPHICS: MACGUI: Fix out-of-screen rendering when submenus are wider than screen


Commit: 6dcf0939bf24b94167a0c78b009b3548edf9893e
    https://github.com/scummvm/scummvm/commit/6dcf0939bf24b94167a0c78b009b3548edf9893e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-05-10T13:58:25+02:00

Commit Message:
SLUDGE: Fix potential buffer overrun

Changed paths:
    engines/sludge/builtin.cpp


diff --git a/engines/sludge/builtin.cpp b/engines/sludge/builtin.cpp
index fbebfc1cf4..e68fe06220 100644
--- a/engines/sludge/builtin.cpp
+++ b/engines/sludge/builtin.cpp
@@ -2571,7 +2571,7 @@ BuiltReturn callBuiltIn(int whichFunc, int numParams, LoadedFunction *fun) {
 }
 
 const char *getBuiltInName(int num) {
-	if (num > NUM_FUNCS)
+	if (num >= NUM_FUNCS)
 		error("getBuiltInName: incorrect builtin number. %d > %d", num, NUM_FUNCS);
 
 	return builtInFunctionArray[num].name;


Commit: 77bfebb3170976f874cff7c7374e33e0d4823b3f
    https://github.com/scummvm/scummvm/commit/77bfebb3170976f874cff7c7374e33e0d4823b3f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-05-10T13:58:25+02:00

Commit Message:
SLUDGE: Fix potential NULL dereference

Changed paths:
    engines/sludge/builtin.cpp


diff --git a/engines/sludge/builtin.cpp b/engines/sludge/builtin.cpp
index e68fe06220..53c4c79cfa 100644
--- a/engines/sludge/builtin.cpp
+++ b/engines/sludge/builtin.cpp
@@ -2385,12 +2385,14 @@ builtIn(_rem_launchWith) {
 		Common::FSList files;
 		gameDataDir.getChildren(files, Common::FSNode::kListFilesOnly);
 
-		for (Common::FSList::const_iterator file = files.begin(); file != files.end(); ++file) {
-			Common::String fileName = file->getName();
-			fileName.toLowercase();
-			if (fileName.hasSuffix(".dat") || fileName == "data") {
-				g_sludge->launchNext = file->getName();
-				return BR_CONTINUE;
+		if (!files.empty()) {
+			for (Common::FSList::const_iterator file = files.begin(); file != files.end(); ++file) {
+				Common::String fileName = file->getName();
+				fileName.toLowercase();
+				if (fileName.hasSuffix(".dat") || fileName == "data") {
+					g_sludge->launchNext = file->getName();
+					return BR_CONTINUE;
+				}
 			}
 		}
 	}


Commit: 84cc106cc508bf9e00928b544b4bae1d8c33dd24
    https://github.com/scummvm/scummvm/commit/84cc106cc508bf9e00928b544b4bae1d8c33dd24
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-05-10T13:58:25+02:00

Commit Message:
SLUDGE: Plug memory leak

Changed paths:
    engines/sludge/builtin.cpp


diff --git a/engines/sludge/builtin.cpp b/engines/sludge/builtin.cpp
index 53c4c79cfa..cd969c0220 100644
--- a/engines/sludge/builtin.cpp
+++ b/engines/sludge/builtin.cpp
@@ -375,6 +375,9 @@ builtIn(pasteImage) {
 		return BR_CONTINUE;
 
 	g_sludge->_cursorMan->pasteCursor(x, y, pp);
+
+	delete pp;
+
 	return BR_CONTINUE;
 }
 


Commit: 6d82d40db6e5e798e758667b29bd87f5a8bba63d
    https://github.com/scummvm/scummvm/commit/6d82d40db6e5e798e758667b29bd87f5a8bba63d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-05-10T13:58:26+02:00

Commit Message:
GRAPHICS: MACGUI: Fix out-of-screen rendering when submenus are wider than screen

Changed paths:
    graphics/macgui/macmenu.cpp


diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp
index 7a32d0c566..d7f9273fbf 100644
--- a/graphics/macgui/macmenu.cpp
+++ b/graphics/macgui/macmenu.cpp
@@ -977,8 +977,18 @@ void MacMenu::renderSubmenu(MacMenuSubMenu *menu, bool recursive) {
 	if (recursive && menu->highlight != -1 && menu->items[menu->highlight]->submenu != nullptr)
 		renderSubmenu(menu->items[menu->highlight]->submenu, false);
 
-	if (_wm->_mode & kWMModalMenuMode)
-		g_system->copyRectToScreen(_screen.getBasePtr(r->left, r->top), _screen.pitch, r->left, r->top, r->width() + 2, r->height() + 2);
+	if (_wm->_mode & kWMModalMenuMode) {
+		// TODO: Instead of cropping, reposition the submenu
+		int w = r->width() + 2;
+		if (r->left + w >= _screen.w)
+			w = _screen.w - 1 - r->left;
+
+		int h = r->height() + 2;
+		if (r->top + h >= _screen.h)
+			h = _screen.h - 1 - r->top;
+
+		g_system->copyRectToScreen(_screen.getBasePtr(r->left, r->top), _screen.pitch, r->left, r->top, w, h);
+	}
 }
 
 void MacMenu::drawSubMenuArrow(ManagedSurface *dst, int x, int y, int color) {
@@ -1093,6 +1103,12 @@ bool MacMenu::mouseClick(int x, int y) {
 					int y1 = menu->items[_activeSubItem]->submenu->bbox.top;
 					uint w = menu->items[_activeSubItem]->submenu->bbox.width() + 2;
 					uint h = menu->items[_activeSubItem]->submenu->bbox.height() + 2;
+
+					if (x1 + w > _wm->_screenCopy->w)
+						w = _wm->_screenCopy->w - 1 - x1;
+					if (y1 + h > _wm->_screenCopy->h)
+						h = _wm->_screenCopy->h - 1 - y1;
+
 					g_system->copyRectToScreen(_wm->_screenCopy->getBasePtr(x1, y1), _wm->_screenCopy->pitch, x1, y1, w, h);
 				}
 			}




More information about the Scummvm-git-logs mailing list