GtkIMContextIME: Avoid committing NULL string
We may get invalid UTF-16 sequences when third party apps or hooks inject WM_CHAR messages. Validate the unicode string before committing. Fixes https://gitlab.com/inkscape/inkscape/-/issues/2088
This commit is contained in:
parent
30d7f33579
commit
f003609d35
@ -336,6 +336,9 @@ gtk_im_context_ime_filter_keypress (GtkIMContext *context,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
utf8 = g_utf16_to_utf8 (event_priv->translation, event_priv->translation_len, NULL, NULL, NULL);
|
utf8 = g_utf16_to_utf8 (event_priv->translation, event_priv->translation_len, NULL, NULL, NULL);
|
||||||
|
if (!utf8)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
g_signal_emit_by_name (context_ime, "commit", utf8);
|
g_signal_emit_by_name (context_ime, "commit", utf8);
|
||||||
g_free (utf8);
|
g_free (utf8);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user