guniprop.c: Avoid creating (temporarily) out-of-bounds pointers

This is detected by UBSan on CHERI systems (e.g. Arm Morello) and could
result in non-derefenceable pointers when compiled without optimizations.
This commit is contained in:
Alex Richardson 2022-12-14 23:55:19 +00:00
parent cfab7d1d48
commit ed6cc1ddb2

View File

@ -573,7 +573,7 @@ g_unichar_toupper (gunichar c)
gunichar val = ATTTABLE (c >> 8, c & 0xff);
if (val >= 0x1000000)
{
const gchar *p = special_case_table + val - 0x1000000;
const gchar *p = special_case_table + (val - 0x1000000);
val = g_utf8_get_char (p);
}
/* Some lowercase letters, e.g., U+000AA, FEMININE ORDINAL INDICATOR,
@ -613,8 +613,8 @@ g_unichar_tolower (gunichar c)
gunichar val = ATTTABLE (c >> 8, c & 0xff);
if (val >= 0x1000000)
{
const gchar *p = special_case_table + val - 0x1000000;
return g_utf8_get_char (p);
const gchar *p = special_case_table + (val - 0x1000000);
return g_utf8_get_char (p);
}
else
{