[Scummvm-git-logs] scummvm master -> 00b977816f7e9bce73a767496ee38a836d8884bd

antoniou79 noreply at scummvm.org
Sun Dec 8 17:11:59 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:
00b977816f BLADERUNNER: Check for failed malloc for thumbnail data


Commit: 00b977816f7e9bce73a767496ee38a836d8884bd
    https://github.com/scummvm/scummvm/commit/00b977816f7e9bce73a767496ee38a836d8884bd
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2024-12-08T19:11:36+02:00

Commit Message:
BLADERUNNER: Check for failed malloc for thumbnail data

Changed paths:
    engines/bladerunner/savefile.cpp


diff --git a/engines/bladerunner/savefile.cpp b/engines/bladerunner/savefile.cpp
index 5a10db6b643..d01c8220a31 100644
--- a/engines/bladerunner/savefile.cpp
+++ b/engines/bladerunner/savefile.cpp
@@ -154,12 +154,13 @@ bool SaveFileManager::readHeader(Common::SeekableReadStream &in, SaveFileHeader
 		} else {
 			uint16 alphamask = (0xFF >> gameDataPixelFormat().aLoss) << gameDataPixelFormat().aShift;
 			uint16 *thumbnailData = (uint16*)malloc(kThumbnailSize); // freed by ScummVM's smartptr
-			for (uint i = 0; i < kThumbnailSize / 2; ++i) {
-				thumbnailData[i] = s.readUint16LE() | alphamask; // We set all pixels to non-transparency
+			if (thumbnailData) {
+				for (uint i = 0; i < kThumbnailSize / 2; ++i) {
+					thumbnailData[i] = s.readUint16LE() | alphamask; // We set all pixels to non-transparency
+				}
+				header._thumbnail = new Graphics::Surface();
+				header._thumbnail->init(80, 60, 160, thumbnailData, gameDataPixelFormat());
 			}
-
-			header._thumbnail = new Graphics::Surface(); // freed by ScummVM's smartptr
-			header._thumbnail->init(80, 60, 160, thumbnailData, gameDataPixelFormat());
 		}
 
 		s.seek(pos);




More information about the Scummvm-git-logs mailing list