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

bonki bonki at users.noreply.github.com
Wed Apr 18 20:18:55 CEST 2018


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

Summary:
f20015f526 ZVISION: Fix crash when loading a savegame
b17cac8029 JANITORIAL: Fix typos
fd4f9c1f2c JANITORIAL: Fix whitespace


Commit: f20015f52668fe94c77e60cbc95bd3d1f6fdbba7
    https://github.com/scummvm/scummvm/commit/f20015f52668fe94c77e60cbc95bd3d1f6fdbba7
Author: Adrian Frühwirth (bonki at users.noreply.github.com)
Date: 2018-04-18T20:18:05+02:00

Commit Message:
ZVISION: Fix crash when loading a savegame

Commit 00e59a3122 introduced a change to savegame handling which
results in savegame thumbnails only being loaded when necessary.
ZVISION's readSaveGameHeader() doesn't under all circumstances
initialize the thumbnail pointer and 00e59a3122 failed to remove an
otherwise unnecessary delete which resulted in the uninitialized
thumbnail pointer being passed to delete (UB).

Thanks to eriktorbjorn for noticing.

Changed paths:
    engines/zvision/file/save_manager.cpp


diff --git a/engines/zvision/file/save_manager.cpp b/engines/zvision/file/save_manager.cpp
index b33d33c..4676272 100644
--- a/engines/zvision/file/save_manager.cpp
+++ b/engines/zvision/file/save_manager.cpp
@@ -162,8 +162,6 @@ Common::Error SaveManager::loadGame(int slot) {
 	scriptManager->deserialize(saveFile);
 
 	delete saveFile;
-	if (header.thumbnail)
-		delete header.thumbnail;
 
 	if (_engine->getGameId() == GID_NEMESIS && scriptManager->getCurrentLocation() == "tv2f") {
 		// WORKAROUND for script bug #6793: location tv2f (stairs) has two states:
@@ -190,16 +188,19 @@ Common::Error SaveManager::loadGame(int slot) {
 }
 
 bool SaveManager::readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header, bool skipThumbnail) {
+	header.saveYear    = 0;
+	header.saveMonth   = 0;
+	header.saveDay     = 0;
+	header.saveHour    = 0;
+	header.saveMinutes = 0;
+	header.saveName.clear();
+	header.thumbnail   = nullptr;
+	header.version     = 0;
+
 	uint32 tag = in->readUint32BE();
 	// Check if it's original savegame than fill header structure
 	if (tag == MKTAG('Z', 'N', 'S', 'G')) {
-		header.saveYear = 0;
-		header.saveMonth = 0;
-		header.saveDay = 0;
-		header.saveHour = 0;
-		header.saveMinutes = 0;
 		header.saveName = "Original Save";
-		header.thumbnail = NULL;
 		header.version = SAVE_ORIGINAL;
 		in->seek(-4, SEEK_CUR);
 		return true;
@@ -226,7 +227,6 @@ bool SaveManager::readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &hea
 	}
 
 	// Read in the save name
-	header.saveName.clear();
 	char ch;
 	while ((ch = (char)in->readByte()) != '\0')
 		header.saveName += ch;


Commit: b17cac80294b15636f8d6df85666b55bd6936b32
    https://github.com/scummvm/scummvm/commit/b17cac80294b15636f8d6df85666b55bd6936b32
Author: Adrian Frühwirth (bonki at users.noreply.github.com)
Date: 2018-04-18T20:18:05+02:00

Commit Message:
JANITORIAL: Fix typos

Changed paths:
    engines/sword25/gfx/graphicengine.cpp


diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp
index fd3b63a..e1b0d55 100644
--- a/engines/sword25/gfx/graphicengine.cpp
+++ b/engines/sword25/gfx/graphicengine.cpp
@@ -362,7 +362,7 @@ void  GraphicEngine::updateLastFrameDuration() {
 }
 
 bool GraphicEngine::saveThumbnailScreenshot(const Common::String &filename) {
-	// Note: In ScumMVM, rather than saivng the thumbnail to a file, we store it in memory
+	// Note: In ScummVM, rather than saving the thumbnail to a file, we store it in memory
 	// until needed when creating savegame files
 	delete _thumbnail;
 


Commit: fd4f9c1f2c5647dd889747d0bbfae027ae76c4fd
    https://github.com/scummvm/scummvm/commit/fd4f9c1f2c5647dd889747d0bbfae027ae76c4fd
Author: Adrian Frühwirth (bonki at users.noreply.github.com)
Date: 2018-04-18T20:18:05+02:00

Commit Message:
JANITORIAL: Fix whitespace

Changed paths:
    engines/sword25/gfx/graphicengine.cpp


diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp
index e1b0d55..ca1f37c 100644
--- a/engines/sword25/gfx/graphicengine.cpp
+++ b/engines/sword25/gfx/graphicengine.cpp
@@ -373,10 +373,10 @@ bool GraphicEngine::saveThumbnailScreenshot(const Common::String &filename) {
 
 void GraphicEngine::ARGBColorToLuaColor(lua_State *L, uint color) {
 	lua_Number components[4] = {
-		(lua_Number)((color >> 16) & 0xff),	// Red
-		(lua_Number)((color >> 8) & 0xff),	// Green
-		(lua_Number)(color & 0xff),			// Blue
-		(lua_Number)(color >> 24),			// Alpha
+		(lua_Number)((color >> 16) & 0xff), // Red
+		(lua_Number)((color >>  8) & 0xff), // Green
+		(lua_Number)( color        & 0xff), // Blue
+		(lua_Number)( color >> 24),         // Alpha
 	};
 
 	lua_newtable(L);





More information about the Scummvm-git-logs mailing list