[Scummvm-git-logs] scummvm master -> 8350f283d0e9ee6c45c752f7f7170e011d8fbffa

sev- sev at scummvm.org
Thu Oct 22 10:14:45 UTC 2020


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:
cc2db8211a AD: Fix crash when fanmade game has only one word
8350f283d0 AD: Process corner cases in name autogeneration


Commit: cc2db8211a9bfde1d94db58f0e452a015bf6db27
    https://github.com/scummvm/scummvm/commit/cc2db8211a9bfde1d94db58f0e452a015bf6db27
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-10-22T11:58:11+02:00

Commit Message:
AD: Fix crash when fanmade game has only one word

Changed paths:
    engines/advancedDetector.cpp


diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp
index adebdc008a..a9d922dc2a 100644
--- a/engines/advancedDetector.cpp
+++ b/engines/advancedDetector.cpp
@@ -91,10 +91,13 @@ static Common::String sanitizeName(const char *name, int maxLen) {
 				maxLen -= word.size();
 			}
 			word.clear();
+
+			if (!*name)
+				break;
 		}
 		if (*name)
 			name++;
-	} while (*name && maxLen > 0);
+	} while (maxLen > 0);
 
 	return res;
 }


Commit: 8350f283d0e9ee6c45c752f7f7170e011d8fbffa
    https://github.com/scummvm/scummvm/commit/8350f283d0e9ee6c45c752f7f7170e011d8fbffa
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-10-22T12:13:13+02:00

Commit Message:
AD: Process corner cases in name autogeneration

- When there are more than one non-alphanum at the end, like "Quest..."
- When there is no alphanum at all: "::::"
- Added error messages if anything else is not caught

Changed paths:
    engines/advancedDetector.cpp


diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp
index a9d922dc2a..3112faf82c 100644
--- a/engines/advancedDetector.cpp
+++ b/engines/advancedDetector.cpp
@@ -77,6 +77,8 @@ private:
 static Common::String sanitizeName(const char *name, int maxLen) {
 	Common::String res;
 	Common::String word;
+	Common::String lastWord;
+	const char *origname = name;
 
 	do {
 		if (Common::isAlnum(*name)) {
@@ -90,15 +92,26 @@ static Common::String sanitizeName(const char *name, int maxLen) {
 
 				maxLen -= word.size();
 			}
-			word.clear();
 
-			if (!*name)
+			if (*name && *(name + 1) == 0) {
+				if (res.empty()) // Make sure that we add at least something
+					res += word.empty() ? lastWord : word;
+
 				break;
+			}
+
+			if (!word.empty())
+				lastWord = word;
+
+			word.clear();
 		}
 		if (*name)
 			name++;
 	} while (maxLen > 0);
 
+	if (res.empty())
+		error("AdvancedDetector: Incorrect extra in game: \"%s\"", origname);
+
 	return res;
 }
 




More information about the Scummvm-git-logs mailing list