[Scummvm-git-logs] scummvm master -> 59ca2de0f2183f112dd3e87e70c33ca35ee9a219

sev- noreply at scummvm.org
Fri Jan 27 18:57:34 UTC 2023


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

Summary:
3c4e528fff DIRECTOR: LINGO: Implemented mGetVM from MemoryXObj
59ca2de0f2 COMMON: Better handling for malformed NE Windows executables


Commit: 3c4e528fffb471b5b6ff10c26150f9f400e99686
    https://github.com/scummvm/scummvm/commit/3c4e528fffb471b5b6ff10c26150f9f400e99686
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-01-27T19:21:12+01:00

Commit Message:
DIRECTOR: LINGO: Implemented mGetVM from MemoryXObj

Changed paths:
    engines/director/lingo/xlibs/memoryxobj.cpp
    engines/director/lingo/xlibs/memoryxobj.h


diff --git a/engines/director/lingo/xlibs/memoryxobj.cpp b/engines/director/lingo/xlibs/memoryxobj.cpp
index 2428366f5a3..5db6ada5d8d 100644
--- a/engines/director/lingo/xlibs/memoryxobj.cpp
+++ b/engines/director/lingo/xlibs/memoryxobj.cpp
@@ -46,6 +46,8 @@
 	I mGetLogicalPage
 	I mGetLogicalRAM
 	I mGetLowMemory
+
+	USED BY: Chop Suey (win)
  */
 
 #include "director/director.h"
@@ -67,6 +69,7 @@ static MethodProto xlibMethods[] = {
 	{ "new",					MemoryXObj::m_new,			0,	0,	300 },	// D3
 	{ "Clear",					MemoryXObj::m_clear,		0,	0,	300 },	// D3
 	{ "Purge",					MemoryXObj::m_purge,		0,	0,	400 },	// D4
+	{ "GetVM",					MemoryXObj::m_getVM,		0,  0,  300 },  // D3
 	{ nullptr, nullptr, 0, 0, 0 }
 };
 
@@ -100,4 +103,8 @@ void MemoryXObj::m_clear(int nargs) {
 void MemoryXObj::m_purge(int nargs) {
 }
 
+void MemoryXObj::m_getVM(int nargs) {
+	g_lingo->push(Datum(0)); // At least Chop Suey Win requires 0 bytes Virtual Memory for running
+}
+
 } // End of namespace Director
diff --git a/engines/director/lingo/xlibs/memoryxobj.h b/engines/director/lingo/xlibs/memoryxobj.h
index ad5f489ae2a..ba44aa3f958 100644
--- a/engines/director/lingo/xlibs/memoryxobj.h
+++ b/engines/director/lingo/xlibs/memoryxobj.h
@@ -41,6 +41,7 @@ void close(int type);
 void m_new(int nargs);
 void m_clear(int nargs);
 void m_purge(int nargs);
+void m_getVM(int nargs);
 
 } // End of namespace MemoryXObj
 


Commit: 59ca2de0f2183f112dd3e87e70c33ca35ee9a219
    https://github.com/scummvm/scummvm/commit/59ca2de0f2183f112dd3e87e70c33ca35ee9a219
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-01-27T19:56:50+01:00

Commit Message:
COMMON: Better handling for malformed NE Windows executables

Changed paths:
    common/formats/winexe_ne.cpp


diff --git a/common/formats/winexe_ne.cpp b/common/formats/winexe_ne.cpp
index fb44eee2fed..491c57b59ed 100644
--- a/common/formats/winexe_ne.cpp
+++ b/common/formats/winexe_ne.cpp
@@ -185,8 +185,15 @@ bool NEResources::readResourceTable(uint32 offset) {
 
 		uint16 resCount = _exe->readUint16LE();
 
+		debug(2, "%d resources in table", resCount);
+
 		_exe->skip(4); // reserved
 
+		if (resCount > 256) {
+			warning("NEResources::readResourceTable(): resource table looks malformed, %d entries > 256", resCount);
+			resCount = 256;
+		}
+
 		for (int i = 0; i < resCount; i++) {
 			Resource res;
 
@@ -233,8 +240,16 @@ String NEResources::getResourceString(SeekableReadStream &exe, uint32 offset) {
 	uint8 length = exe.readByte();
 
 	String string;
-	for (uint16 i = 0; i < length; i++)
-		string += (char)exe.readByte();
+	for (uint16 i = 0; i < length; i++) {
+		char b = (char)exe.readByte();
+
+		// Do not read beyond end of string
+		if (!b) {
+			break;
+		}
+
+		string += b;
+	}
 
 	exe.seek(curPos);
 	return string;




More information about the Scummvm-git-logs mailing list