[Scummvm-cvs-logs] scummvm master -> 23511d4162e853217eb74ad9770e515fdba668a7

m-kiewitz m_kiewitz at users.sourceforge.net
Mon Jun 15 23:07:11 CEST 2015


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:
23511d4162 SHERLOCK: 3DO: loadScene: verify .BG file size


Commit: 23511d4162e853217eb74ad9770e515fdba668a7
    https://github.com/scummvm/scummvm/commit/23511d4162e853217eb74ad9770e515fdba668a7
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2015-06-15T23:06:59+02:00

Commit Message:
SHERLOCK: 3DO: loadScene: verify .BG file size

Changed paths:
    engines/sherlock/scene.cpp



diff --git a/engines/sherlock/scene.cpp b/engines/sherlock/scene.cpp
index c418a02..cd625ba 100644
--- a/engines/sherlock/scene.cpp
+++ b/engines/sherlock/scene.cpp
@@ -951,16 +951,22 @@ bool Scene::loadScene(const Common::String &filename) {
 
 		Common::File roomBackgroundStream;
 		if (!roomBackgroundStream.open(roomBackgroundFilename))
-			error("Could not load file - %s", roomBackgroundFilename.c_str());
+			error("Could not open file - %s", roomBackgroundFilename.c_str());
 
 		int totalPixelCount = SHERLOCK_SCREEN_WIDTH * SHERLOCK_SCENE_HEIGHT;
 		uint16 *roomBackgroundDataPtr = NULL;
 		uint16 *pixelSourcePtr = NULL;
 		uint16 *pixelDestPtr = (uint16 *)screen._backBuffer1.getPixels();
 		uint16  curPixel = 0;
+		uint32  roomBackgroundStreamSize = roomBackgroundStream.size();
+		uint32  expectedBackgroundSize   = totalPixelCount * 2;
+
+		// Verify file size of background file
+		if (expectedBackgroundSize != roomBackgroundStreamSize)
+			error("loadScene: 3DO room background file not expected size");
 
 		roomBackgroundDataPtr = new uint16[totalPixelCount];
-		roomBackgroundStream.read(roomBackgroundDataPtr, totalPixelCount * 2);
+		roomBackgroundStream.read(roomBackgroundDataPtr, roomBackgroundStreamSize);
 		roomBackgroundStream.close();
 
 		// Convert data from RGB555 to RGB565






More information about the Scummvm-git-logs mailing list