[Scummvm-git-logs] scummvm master -> 7361c0f2fa57ce988829205e755ca4f1daf5cba2

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


Commit: 7361c0f2fa57ce988829205e755ca4f1daf5cba2
    https://github.com/scummvm/scummvm/commit/7361c0f2fa57ce988829205e755ca4f1daf5cba2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-01-05T01:04:08+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 4e1d4d3c6d1..3d333839b6b 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -1504,13 +1504,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