[Scummvm-git-logs] scummvm branch-2-8 -> 9db6f3a19f4e5f55ee785fe340ecec6a07325984

sev- noreply at scummvm.org
Fri Jan 5 00:05:56 UTC 2024


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:
9db6f3a19f GRAPHICS: MACGUI: Made readHex() more robust


Commit: 9db6f3a19f4e5f55ee785fe340ecec6a07325984
    https://github.com/scummvm/scummvm/commit/9db6f3a19f4e5f55ee785fe340ecec6a07325984
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-01-05T01:05:44+01:00

Commit Message:
GRAPHICS: MACGUI: Made readHex() more robust

This fixes crashes in Markdown with malformed translations

Changed paths:
    graphics/macgui/macwindowmanager.cpp


diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index c2fcdfd1884..4f4c3a3efe5 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -1503,13 +1503,13 @@ const Common::U32String::value_type *readHex(uint16 *res, const Common::U32Strin
 	*res = 0;
 
 	for (int i = 0; i < len; i++) {
-		char b = (char)*s++;
+		char b = tolower((char)*s++);
 
 		*res <<= 4;
-		if (tolower(b) >= 'a')
-			*res |= tolower(b) - 'a' + 10;
-		else
-			*res |= tolower(b) - '0';
+		if (b >= 'a' && b <= 'f')
+			*res |= b - 'a' + 10;
+		else if (b >= '0' && b <= '9')
+			*res |= b - '0';
 	}
 
 	return s;




More information about the Scummvm-git-logs mailing list