Fix the upper bound in g_unichar_iswide_bsearch

asan noticed an array out of bound access in this function, which was
because we were accessing G_N_ELEMENTS + 1.

https://bugzilla.gnome.org/show_bug.cgi?id=766211
This commit is contained in:
Iain Lane 2016-05-10 09:46:06 +01:00 committed by Matthias Clasen
parent 9a865020ca
commit bcbd8d73ce

View File

@ -439,7 +439,7 @@ static inline gboolean
g_unichar_iswide_bsearch (gunichar ch)
{
int lower = 0;
int upper = G_N_ELEMENTS (g_unicode_width_table_wide) + 1;
int upper = G_N_ELEMENTS (g_unicode_width_table_wide) - 1;
static int saved_mid = G_WIDTH_TABLE_MIDPOINT;
int mid = saved_mid;