mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-03 09:23:37 +00:00
GRAPHICS: MACGUI: Made readHex() more robust
This fixes crashes in Markdown with malformed translations
This commit is contained in:
parent
f7f152ca1d
commit
7361c0f2fa
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user