[Scummvm-git-logs] scummvm master -> 48fb15812dadf331749733d0ef02c091e111ec6a

athrxx athrxx at scummvm.org
Fri Sep 10 16:23:56 UTC 2021


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:
48fb15812d SCUMM: (DIG) - fix workaround for Russian version so as not to write outside the expected scope


Commit: 48fb15812dadf331749733d0ef02c091e111ec6a
    https://github.com/scummvm/scummvm/commit/48fb15812dadf331749733d0ef02c091e111ec6a
Author: athrxx (athrxx at scummvm.org)
Date: 2021-09-10T18:21:41+02:00

Commit Message:
SCUMM: (DIG) - fix workaround for Russian version so as not to write outside the expected scope

I experienced weird string modifications while trying to improve the text code. Turns out that this workaround will kick in even for 0 length strings and will lead to values being written to "negative" (before the original dst ptr argument) offsets.

Changed paths:
    engines/scumm/string.cpp


diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp
index aa912335f5..d99f3574d5 100644
--- a/engines/scumm/string.cpp
+++ b/engines/scumm/string.cpp
@@ -1239,10 +1239,11 @@ int ScummEngine::convertMessageToString(const byte *msg, byte *dst, int dstSize)
 	byte chr;
 	byte lastChr = 0;
 	const byte *src;
-	byte *end;
+	byte *start, *end;
 	byte transBuf[2048];
 
 	assert(dst);
+	start = dst;
 	end = dst + dstSize;
 
 	if (msg == NULL) {
@@ -1360,7 +1361,7 @@ int ScummEngine::convertMessageToString(const byte *msg, byte *dst, int dstSize)
 	// it does not work as is with our rendering code, thus fixing it
 	// with a workaround.
 	if (_game.id == GID_DIG) {
-		while (*(dst - 1) == 0x03)
+		while (dst > start && *(dst - 1) == 0x03)
 			dst--;
 	}
 	*dst = 0;




More information about the Scummvm-git-logs mailing list