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

dreammaster paulfgilbert at gmail.com
Wed Sep 30 04:03:56 UTC 2020


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:
da60c10515 GLK: LEVEL9: Fix memory overrun in game detector


Commit: da60c105158fc19febf1b40e5ecec101a8cbcbca
    https://github.com/scummvm/scummvm/commit/da60c105158fc19febf1b40e5ecec101a8cbcbca
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-09-29T21:01:43-07:00

Commit Message:
GLK: LEVEL9: Fix memory overrun in game detector

Changed paths:
    engines/glk/level9/detection.cpp


diff --git a/engines/glk/level9/detection.cpp b/engines/glk/level9/detection.cpp
index adb416e46a..6b19ce3010 100644
--- a/engines/glk/level9/detection.cpp
+++ b/engines/glk/level9/detection.cpp
@@ -155,7 +155,7 @@ long Scanner::ScanV2(byte *startFile, uint32 size) {
 
 	for (i = 0; i < size - 28; i++) {
 		num = L9WORD(startFile + i + 28) + 1;
-		if (i + num <= size && ((Chk[i + num] - Chk[i + 32]) & 0xff) == startFile[i + 0x1e]) {
+		if ((i + num) <= size && i < (size - 32) && ((Chk[i + num] - Chk[i + 32]) & 0xff) == startFile[i + 0x1e]) {
 			for (j = 0; j < 14; j++) {
 				d0 = L9WORD(startFile + i + j * 2);
 				if (j != 13 && d0 >= 0x8000 && d0 < 0x9000) {
@@ -743,7 +743,7 @@ bool Level9MetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &
 
 		// Read in the game data
 		Common::Array<byte> data;
-		data.resize(fileSize);
+		data.resize(fileSize + 1);
 		gameFile.read(&data[0], fileSize);
 		gameFile.close();
 




More information about the Scummvm-git-logs mailing list