mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-31 04:43:06 +02:00
g_unichar_iswide_cjk: add a special case for U+0000
bsearch() is defined to search for a non-null key, so we can't search for NULL. The undefined behaviour sanitizer picks this up. Signed-off-by: Simon McVittie <smcv@debian.org> Bug: https://bugzilla.gnome.org/show_bug.cgi?id=775510 Reviewed-by: Colin Walters
This commit is contained in:
parent
663e12feca
commit
1d697a5f30
@ -503,6 +503,11 @@ g_unichar_iswide_cjk (gunichar c)
|
|||||||
if (g_unichar_iswide (c))
|
if (g_unichar_iswide (c))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
/* bsearch() is declared attribute(nonnull(1)) so we can't validly search
|
||||||
|
* for a NULL key */
|
||||||
|
if (c == 0)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (bsearch (GUINT_TO_POINTER (c),
|
if (bsearch (GUINT_TO_POINTER (c),
|
||||||
g_unicode_width_table_ambiguous,
|
g_unicode_width_table_ambiguous,
|
||||||
G_N_ELEMENTS (g_unicode_width_table_ambiguous),
|
G_N_ELEMENTS (g_unicode_width_table_ambiguous),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user