Filter out invalid chars to avoid out-of-bounds memory access
This commit is contained in:
@@ -58,7 +58,7 @@ int getTextWidth(const char * s, int len, LcdFlags flags)
|
|||||||
if (!c) {
|
if (!c) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (c >= 0xFE) {
|
else if (c >= 0xFE) { // CJK marker
|
||||||
s++;
|
s++;
|
||||||
c = uint8_t(*s) + ((c & 0x01) << 8) - 1;
|
c = uint8_t(*s) + ((c & 0x01) << 8) - 1;
|
||||||
if (c >= 0x101)
|
if (c >= 0x101)
|
||||||
@@ -66,7 +66,7 @@ int getTextWidth(const char * s, int len, LcdFlags flags)
|
|||||||
c += CJK_FIRST_LETTER_INDEX;
|
c += CJK_FIRST_LETTER_INDEX;
|
||||||
result += getFontPatternWidth(specs, c) + 1;
|
result += getFontPatternWidth(specs, c) + 1;
|
||||||
}
|
}
|
||||||
else if (c >= 0x20) {
|
else if ((c >= 0x20) && (c < CJK_FIRST_LETTER_INDEX + 0x20)) { // debug
|
||||||
result += getCharWidth(c, specs);
|
result += getCharWidth(c, specs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
Submodule radio/src/thirdparty/libopenui updated: 48c83e701d...7c2c8512b3
Reference in New Issue
Block a user