mpegts: fix invalid memory access in language descriptor

Also add a couple sanity asserts/returns

https://bugzilla.gnome.org/show_bug.cgi?id=781024
This commit is contained in:
Vincent Penquerc'h 2017-04-07 10:43:51 +01:00 committed by Sebastian Dröge
parent a3a12d0978
commit 9eab67a4af

View file

@ -855,6 +855,7 @@ gst_mpegts_descriptor_from_registration (const gchar * format_identifier,
GstMpegtsDescriptor *descriptor;
g_return_val_if_fail (format_identifier != NULL, NULL);
g_return_val_if_fail (additional_info_length > 0 || !additional_info, NULL);
descriptor = _new_descriptor (GST_MTS_DESC_REGISTRATION,
4 + additional_info_length);
@ -1055,7 +1056,7 @@ gst_mpegts_descriptor_from_iso_639_language (const gchar * language)
g_return_val_if_fail (language != NULL, NULL);
descriptor = _new_descriptor (GST_MTS_DESC_ISO_639_LANGUAGE, 4 + 4); /* a language takes 4 bytes */
descriptor = _new_descriptor (GST_MTS_DESC_ISO_639_LANGUAGE, 4); /* a language takes 4 bytes */
memcpy (descriptor->data + 2, language, 3);
descriptor->data[2 + 3] = 0; /* set audio type to undefined */
@ -1116,6 +1117,8 @@ gst_mpegts_descriptor_from_custom (guint8 tag, const guint8 * data,
{
GstMpegtsDescriptor *descriptor;
g_return_val_if_fail (length > 0 || !data, NULL);
descriptor = _new_descriptor (tag, length);
if (data && (length > 0))