Commit 564b4e66 authored by Marc-André Lureau's avatar Marc-André Lureau Committed by Matthias Clasen

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.
parent 7ffaab3f
......@@ -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,
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);
wclen++; /* Terminating 0 */
size = wclen * 2;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment