flvdemux: Handle empty metadata strings

g_utf8_validate() errors out on empty string. But empty strings are valid,
so only check if they're not

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/596>
This commit is contained in:
Edward Hervey 2020-05-20 10:45:16 +02:00 committed by Edward Hervey
parent 9f5f906515
commit e8282661b6

View file

@ -202,7 +202,8 @@ FLV_GET_STRING (GstByteReader * reader)
}
memcpy (string, str, string_size);
if (!g_utf8_validate (string, string_size, NULL)) {
/* Check utf-8 validity if it's not an empty string */
if (string[0] && !g_utf8_validate (string, string_size, NULL)) {
g_free (string);
return NULL;
}