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

sluicebox 22204938+sluicebox at users.noreply.github.com
Tue Nov 26 00:44:33 UTC 2019


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:
b658ef31de SCI32: Fix kFileIOReadRaw when fewer bytes than requested


Commit: b658ef31deb46019359824da5deba62295ffa990
    https://github.com/scummvm/scummvm/commit/b658ef31deb46019359824da5deba62295ffa990
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2019-11-25T16:41:15-08:00

Commit Message:
SCI32: Fix kFileIOReadRaw when fewer bytes than requested

Fixes censorship password in Phantasmagoria 1

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


diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index f364e9d..007f805 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -586,18 +586,15 @@ reg_t kFileIOReadRaw(EngineState *s, int argc, reg_t *argv) {
 	uint16 handle = argv[0].toUint16();
 	uint16 size = argv[2].toUint16();
 	int bytesRead = 0;
-	char *buf = new char[size];
+	byte *buf = new byte[size];
 	debugC(kDebugLevelFile, "kFileIO(readRaw): %d, %d", handle, size);
 
 	FileHandle *f = getFileFromHandle(s, handle);
 	if (f)
 		bytesRead = f->_in->read(buf, size);
 
-	// TODO: What happens if less bytes are read than what has
-	// been requested? (i.e. if bytesRead is non-zero, but still
-	// less than size)
 	if (bytesRead > 0)
-		s->_segMan->memcpy(argv[1], (const byte*)buf, size);
+		s->_segMan->memcpy(argv[1], buf, bytesRead);
 
 	delete[] buf;
 	return make_reg(0, bytesRead);




More information about the Scummvm-git-logs mailing list