mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 05:50:10 +00:00
win32: do not crash on invalid utf8 conversion
g_utf8_to_utf16() is not guaranteed to succeed. Check the error and return if it failed. https://bugzilla.gnome.org/show_bug.cgi?id=696232
This commit is contained in:
parent
7ffaab3f91
commit
564b4e667a
@ -150,6 +150,7 @@ _gdk_win32_window_change_property (GdkWindow *window,
|
||||
guchar *ucptr;
|
||||
wchar_t *wcptr, *p;
|
||||
glong wclen;
|
||||
GError *err = NULL;
|
||||
|
||||
g_return_if_fail (window != NULL);
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
@ -193,7 +194,13 @@ _gdk_win32_window_change_property (GdkWindow *window,
|
||||
return;
|
||||
}
|
||||
|
||||
wcptr = g_utf8_to_utf16 ((char *) data, nelements, NULL, &wclen, NULL);
|
||||
wcptr = g_utf8_to_utf16 ((char *) data, nelements, NULL, &wclen, &err);
|
||||
if (err != NULL)
|
||||
{
|
||||
g_warning ("Failed to convert utf8: %s", err->message);
|
||||
g_clear_error (&err);
|
||||
return;
|
||||
}
|
||||
|
||||
wclen++; /* Terminating 0 */
|
||||
size = wclen * 2;
|
||||
|
Loading…
Reference in New Issue
Block a user