[Scummvm-git-logs] scummvm master -> 73289aa2a72f8a548b6fec304ec3f32f19d51423

bluegr noreply at scummvm.org
Tue Aug 25 18:46:35 UTC 2026


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

Summary:
73289aa2a7 SCI: Fix eos() check


Commit: 73289aa2a72f8a548b6fec304ec3f32f19d51423
    https://github.com/scummvm/scummvm/commit/73289aa2a72f8a548b6fec304ec3f32f19d51423
Author: Miro Kropacek (miro.kropacek at gmail.com)
Date: 2026-08-25T21:46:30+03:00

Commit Message:
SCI: Fix eos() check

Stop at the end of the stream: eos() returns true only after a failed
read so in this case it returned false in every case and it was

if (fileStream->eos()) {
    delete fileStream;
    return curVersion;
}

which actually returned the version.

This causes subtle errors on platforms which are not fully POSIX
compliant, e.g. on Atari the skip(2) would actually append (!) two bytes
to the file.

Changed paths:
    engines/sci/resource/resource.cpp


diff --git a/engines/sci/resource/resource.cpp b/engines/sci/resource/resource.cpp
index 97404e421fe..c757692038a 100644
--- a/engines/sci/resource/resource.cpp
+++ b/engines/sci/resource/resource.cpp
@@ -1415,9 +1415,10 @@ ResVersion ResourceManager::detectVolVersion() {
 	ResVersion curVersion = kResVersionSci0Sci1Early;
 	bool failed = false;
 	bool sci11Align = false;
+	const int64 fileSizeLimit = MIN<int64>(0x100000, fileStream->size());
 
 	// Check for SCI0, SCI1, SCI1.1, SCI32 v2 (Gabriel Knight 1 CD) and SCI32 v3 (LSL7) formats
-	while (!fileStream->eos() && fileStream->pos() < 0x100000) {
+	while (fileStream->pos() < fileSizeLimit) {
 		if (curVersion > kResVersionSci0Sci1Early)
 			fileStream->readByte();
 		fileStream->skip(2);	// resId




More information about the Scummvm-git-logs mailing list