[Scummvm-git-logs] scummvm master -> 61508d7ba6136fd260f36c959ef0ee816b318b8b

a-yyg 76591232+a-yyg at users.noreply.github.com
Wed Jul 28 20:03:27 UTC 2021


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

Summary:
6462095999 SAGA2: Warn for onAcceptLockToggle
fde5b01c5e SAGA2: Fix strcpy overlap
4b58eae8c1 SAGA2: Fix data signedness
61508d7ba6 SAGA2: Fix strncat usage


Commit: 646209599954ae45f5acfcaedd8b664cdfb808ad
    https://github.com/scummvm/scummvm/commit/646209599954ae45f5acfcaedd8b664cdfb808ad
Author: a/ (yuri.kgpps at gmail.com)
Date: 2021-07-29T05:02:28+09:00

Commit Message:
SAGA2: Warn for onAcceptLockToggle

Changed paths:
    engines/saga2/objproto.cpp


diff --git a/engines/saga2/objproto.cpp b/engines/saga2/objproto.cpp
index cca07e3d7b..a9d177808c 100644
--- a/engines/saga2/objproto.cpp
+++ b/engines/saga2/objproto.cpp
@@ -677,6 +677,7 @@ bool ProtoObj::acceptLockToggle(
 	if (!canToggleLock(dObj, enactor, keyCode)) return false;
 
 	//  Handle object script in a standard fashion
+	warning("ProtoObj::acceptLockToggle: Method_GameObject_onAcceptLockToggle undefined");
 	if ((scriptResult = stdActionScript(
 	                        Method_GameObject_onAcceptLockToggle,
 	                        dObj, enactor, Nothing))


Commit: fde5b01c5e4f7a42980ed806b1697c092b76a032
    https://github.com/scummvm/scummvm/commit/fde5b01c5e4f7a42980ed806b1697c092b76a032
Author: a/ (yuri.kgpps at gmail.com)
Date: 2021-07-29T05:02:28+09:00

Commit Message:
SAGA2: Fix strcpy overlap

Changed paths:
    engines/saga2/document.cpp


diff --git a/engines/saga2/document.cpp b/engines/saga2/document.cpp
index 20b360e567..d3ff7762ba 100644
--- a/engines/saga2/document.cpp
+++ b/engines/saga2/document.cpp
@@ -160,13 +160,13 @@ CDocument::CDocument(CDocumentAppearance &dApp,
 	origText = new char[textSize + 1];
 
 	// and fill it
-	strcpy(origText, buffer);
+	Common::strlcpy(origText, buffer, textSize);
 
 	// make a working buffer
 	text = new char[textSize + 1];
 
 	// and fill it
-	strcpy(text, origText);
+	Common::strlcpy(text, origText, textSize);
 
 	textFont        = font;
 	textHeight      = (textFont ? textFont->height : 0);
@@ -357,6 +357,7 @@ bool CDocument::checkForPageBreak(char *string, uint16 index, int32 &offset) {
 
 	// get the current index into the string
 	char    *strIndex       = string + index;
+	char *strAfter;
 
 	// page break detected
 	if (strIndex[1] == dPageBreak[0] &&
@@ -364,14 +365,18 @@ bool CDocument::checkForPageBreak(char *string, uint16 index, int32 &offset) {
 		// eat the page breaks chars
 		// tie off the end
 		strIndex[0] = 0;
+		strAfter = new char[textSize];
+		Common::strlcpy(strAfter, &strIndex[3], textSize);
 
 		// string them together
-		strcat(&strIndex[0], &strIndex[2 + 1]);
+		strcat(&strIndex[0], strAfter);
 
 		// take the offset to the end of this line
 		offset = index;
 
 		// and set the new page flag
+
+		delete[] strAfter;
 		return true;
 	}
 
@@ -461,7 +466,7 @@ bool CDocument::checkForImage(char      *string,
 
 void CDocument::makePages(void) {
 	// copy the original text back to the working buffer
-	strcpy(text, origText);
+	Common::strlcpy(text, origText, textSize);
 
 
 	char    *str            = text;
@@ -692,10 +697,10 @@ void appendBookText(char *string) {
 void buildText(uint16 textScript) {
 	if (textScript > 0) {
 		// clear out the scroll text
-		strcpy(bookText, "");
+		Common::strlcpy(bookText, "", sizeof(bookText));
 
 		if (textScript == resImports->reserved[0]) {
-			strcpy(bookText, PROGRAM_ABOUT);
+			Common::strlcpy(bookText, PROGRAM_ABOUT, sizeof(bookText));
 		}
 
 		// generate the text for the book


Commit: 4b58eae8c1070a7a3174b7d37fafe5207f94dc95
    https://github.com/scummvm/scummvm/commit/4b58eae8c1070a7a3174b7d37fafe5207f94dc95
Author: a/ (yuri.kgpps at gmail.com)
Date: 2021-07-29T05:02:28+09:00

Commit Message:
SAGA2: Fix data signedness

Changed paths:
    engines/saga2/interp.cpp


diff --git a/engines/saga2/interp.cpp b/engines/saga2/interp.cpp
index e1d95f2f9e..5afe2757b7 100644
--- a/engines/saga2/interp.cpp
+++ b/engines/saga2/interp.cpp
@@ -211,7 +211,7 @@ uint8 *segmentArrayAddress(uint16 segment, uint16 index) {
 	if (segHandle == nullptr)
 		return nullptr;
 
-	return segHandle + sizeof(uint16) + (index * READ_LE_INT16(segHandle));
+	return segHandle + sizeof(uint16) + (uint16)(index * READ_LE_INT16(segHandle));
 }
 
 //  Returns the address of a byte given an addressing mode
@@ -452,7 +452,7 @@ uint8 *Thread::strAddress(int strNum) {
 	assert(codeSeg);
 	assert(strSeg);
 
-	return strSeg + READ_LE_INT16(strSeg + 2 * strNum);
+	return strSeg + (uint16)READ_LE_INT16(strSeg + 2 * strNum);
 }
 
 //-----------------------------------------------------------------------


Commit: 61508d7ba6136fd260f36c959ef0ee816b318b8b
    https://github.com/scummvm/scummvm/commit/61508d7ba6136fd260f36c959ef0ee816b318b8b
Author: a/ (yuri.kgpps at gmail.com)
Date: 2021-07-29T05:02:28+09:00

Commit Message:
SAGA2: Fix strncat usage

Changed paths:
    engines/saga2/document.cpp


diff --git a/engines/saga2/document.cpp b/engines/saga2/document.cpp
index d3ff7762ba..67b21ebbc9 100644
--- a/engines/saga2/document.cpp
+++ b/engines/saga2/document.cpp
@@ -685,7 +685,7 @@ char            bookText[textSize] = { "" };
 
 void appendBookText(char *string) {
 	if (string) {
-		strncat(bookText, string, textSize - 1);
+		Common::strlcat(bookText, string, textSize - 1);
 		bookText[textSize - 1] = 0;
 	}
 }




More information about the Scummvm-git-logs mailing list