output: Validate EDID information as UTF-8 only if it exists

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3021
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3268>
This commit is contained in:
Sebastian Wick 2023-09-12 20:08:10 +02:00
parent 4514d29c90
commit c96341dcd5

View File

@ -330,7 +330,8 @@ set_output_details_from_edid (MetaOutputInfo *output_info,
g_clear_pointer (&output_info->vendor, g_free);
output_info->product = g_strdup (edid_info->dsc_product_name);
if (!g_utf8_validate (output_info->product, -1, NULL) ||
if (!output_info->product ||
!g_utf8_validate (output_info->product, -1, NULL) ||
output_info->product[0] == '\0')
{
g_clear_pointer (&output_info->product, g_free);
@ -339,7 +340,8 @@ set_output_details_from_edid (MetaOutputInfo *output_info,
}
output_info->serial = g_strdup (edid_info->dsc_serial_number);
if (!g_utf8_validate (output_info->serial, -1, NULL) ||
if (!output_info->serial ||
!g_utf8_validate (output_info->serial, -1, NULL) ||
output_info->serial[0] == '\0')
{
g_clear_pointer (&output_info->serial, g_free);