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

bluegr bluegr at gmail.com
Tue Mar 17 07:37:00 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:
f25ffc2eea SCI32: Add a sanity check for array structures in kFileIOReadRaw


Commit: f25ffc2eea19b390ee24cf7d98d8c57209a7fde1
    https://github.com/scummvm/scummvm/commit/f25ffc2eea19b390ee24cf7d98d8c57209a7fde1
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2020-03-17T09:36:38+02:00

Commit Message:
SCI32: Add a sanity check for array structures in kFileIOReadRaw

Changed paths:
    engines/sci/engine/kfile.cpp


diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index e636c45201..b7e2a94a5d 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -595,8 +595,11 @@ reg_t kFileIOReadRaw(EngineState *s, int argc, reg_t *argv) {
 
 	FileHandle *f = getFileFromHandle(s, handle);
 	if (f) {
+#ifdef ENABLE_SCI32
 		SegmentRef destReference = s->_segMan->dereference(dest);
-		if (destReference.maxSize == size - 4) {
+		SegmentObj *destObject = s->_segMan->getSegmentObj(dest.getSegment());
+
+		if (destReference.maxSize == size - 4 && destObject->getType() == SEG_TYPE_ARRAY) {
 			// This is an array structure, which starts with the number of
 			// elements in the array and the size of each element. Skip
 			// these bytes. These structures are stored in the ARC files of
@@ -604,6 +607,7 @@ reg_t kFileIOReadRaw(EngineState *s, int argc, reg_t *argv) {
 			f->_in->skip(4);
 			size -= 4;
 		}
+#endif
 
 		bytesRead = f->_in->read(buf, size);
 	}




More information about the Scummvm-git-logs mailing list