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

sluicebox 22204938+sluicebox at users.noreply.github.com
Fri Feb 19 20:29:38 UTC 2021


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:
7f4198c1a9 SCI: Fix Kernel::lookupText out-of-bounds detection
a921c08043 SCI: Fix SQ4 software clerk's random message


Commit: 7f4198c1a9a42f26682c85ae12b07dd73d4c5eac
    https://github.com/scummvm/scummvm/commit/7f4198c1a9a42f26682c85ae12b07dd73d4c5eac
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2021-02-19T12:13:21-08:00

Commit Message:
SCI: Fix Kernel::lookupText out-of-bounds detection

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


diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index 0fed966653..b199a9946a 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -920,7 +920,7 @@ Common::String Kernel::lookupText(reg_t address, int index) {
 	}
 
 	int _index = index;
-	while (index--)
+	while (index-- && textlen)
 		while (textlen-- && *seeker++)
 			;
 


Commit: a921c08043ea131a5f263e1d207b9d25f2c14611
    https://github.com/scummvm/scummvm/commit/a921c08043ea131a5f263e1d207b9d25f2c14611
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2021-02-19T12:25:55-08:00

Commit Message:
SCI: Fix SQ4 software clerk's random message

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


diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 409e19a724..7324e0b703 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -18871,6 +18871,28 @@ static const uint16 sq4CdPatchUnstableOrdnance[] = {
 	PATCH_END
 };
 
+// When entering the software store, there's a 1/3 chance that the clerk's
+//  second message isn't displayed in some floppy versions. The script calls
+//  kRandom(0,2) to pick which text to print but it tests the result against
+//  three instead of two. When kRandom returns two, zero gets passed to kDisplay
+//  instead of a string address and an out of bounds read occurs. We fix the
+//  test so that the message is displayed.
+//
+// Applies to: English PC VGA Floppy
+// Responsible method: clerkScript:changeState(1)
+static const uint16 sq4FloppySignatureSoftwareClerkMessage[] = {
+	0x35, SIG_MAGICDWORD, 0x03,         // ldi 03
+	0x1a,                               // eq?
+	0x30, SIG_UINT16(0x0003),           // bnt 0003
+	0x72,                               // lofsa "If you're here to return something..."
+	SIG_END
+};
+
+static const uint16 sq4FloppyPatchSoftwareClerkMessage[] = {
+	0x35, 0x02,                         // ldi 02
+	PATCH_END
+};
+
 //          script, description,                                      signature                                      patch
 static const SciScriptPatcherEntry sq4Signatures[] = {
 	{  true,     1, "Floppy: EGA intro delay fix",                    2, sq4SignatureEgaIntroDelay,                     sq4PatchEgaIntroDelay },
@@ -18901,6 +18923,7 @@ static const SciScriptPatcherEntry sq4Signatures[] = {
 	{  true,   390, "CD: hz so good sequel police cycler fix",        1, sq4CdSignatureHzSoGoodSequelPoliceCycler,      sq4CdPatchHzSoGoodSequelPoliceCycler },
 	{  true,   391, "CD: missing Audio for universal remote control", 1, sq4CdSignatureMissingAudioUniversalRemote,     sq4CdPatchMissingAudioUniversalRemote },
 	{  true,   396, "CD: get points for changing back clothes fix",   1, sq4CdSignatureGetPointsForChangingBackClothes, sq4CdPatchGetPointsForChangingBackClothes },
+	{  true,   397, "Floppy: software clerk message fix",             1, sq4FloppySignatureSoftwareClerkMessage,        sq4FloppyPatchSoftwareClerkMessage },
 	{  true,   405, "CD/Floppy: zero gravity blast fix",              1, sq4SignatureZeroGravityBlast,                  sq4PatchZeroGravityBlast },
 	{  true,   406, "CD/Floppy: zero gravity blast fix",              1, sq4SignatureZeroGravityBlast,                  sq4PatchZeroGravityBlast },
 	{  true,   410, "CD/Floppy: zero gravity blast fix",              1, sq4SignatureZeroGravityBlast,                  sq4PatchZeroGravityBlast },




More information about the Scummvm-git-logs mailing list