g_vasprintf crashes when passed invalid UTF-8
https://gitlab.gnome.org/GNOME/glib/-/blob/main/glib/gprintf.c#L365
g_printf_string_upper_bound
return less then 1 len
g_new
alloced NULL
len = _g_vsprintf (*string, format, args2);
used NULL *string
at finally crashed
i propose solution
gsize nsize = g_printf_string_upper_bound (format, args);
if (nsize < 1)
{
*string = NULL;
return nsize;
}
*string = g_new (gchar, nsize);
Edited by voip dev