g_content_type_guess segfaults when passed an empty data buffer on Mac OS
See also: https://github.com/fontforge/fontforge/issues/3553 for more info.
This case in particular was from calling g_content_type_guess
with a non NULL data
buffer, but where the data_size
is 0.
The issue is here: https://gitlab.gnome.org/GNOME/glib/blob/master/gio/gosxcontenttype.m#L539
xdg_mime_get_mime_type_for_data
is called with result_prio
being NULL
. However, if len
is 0, then result_prio
is unconditionally set to 100:
https://gitlab.gnome.org/GNOME/glib/blob/master/gio/xdgmime/xdgmime.c#L534
Leading to the segfault.