aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMartin Kiewitz2015-06-15 23:06:59 +0200
committerMartin Kiewitz2015-06-15 23:06:59 +0200
commit23511d4162e853217eb74ad9770e515fdba668a7 (patch)
tree3c1d9c3d3250d33bf5808a761604c814b2d52acc /engines
parent7bd8988aa309fcbd466737267e554736c02d504c (diff)
downloadscummvm-rg350-23511d4162e853217eb74ad9770e515fdba668a7.tar.gz
scummvm-rg350-23511d4162e853217eb74ad9770e515fdba668a7.tar.bz2
scummvm-rg350-23511d4162e853217eb74ad9770e515fdba668a7.zip
SHERLOCK: 3DO: loadScene: verify .BG file size
Diffstat (limited to 'engines')
-rw-r--r--engines/sherlock/scene.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/engines/sherlock/scene.cpp b/engines/sherlock/scene.cpp
index c418a027f0..cd625bab87 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