mxfdemux: Keep tracking the offsets even when an index table was found

Some files may contain a partial index table, leading into a crash when
you try seeking in them

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7626>
This commit is contained in:
Vivia Nikolaidou 2024-10-09 16:23:47 +03:00 committed by GStreamer Marge Bot
parent 9a232f7983
commit 7cc16b64b7

View file

@ -2875,6 +2875,9 @@ gst_mxf_demux_handle_generic_container_essence_element (GstMXFDemux * demux,
return ret;
}
if (!etrack->offsets)
etrack->offsets = g_array_new (FALSE, TRUE, sizeof (GstMXFDemuxIndex));
if (!index_entry.initialized) {
/* This can happen when doing scanning without entry tables */
index_entry.duration = 1;
@ -2890,12 +2893,11 @@ gst_mxf_demux_handle_generic_container_essence_element (GstMXFDemux * demux,
etrack->track_id, index_entry.dts, index_entry.offset,
index_entry.keyframe);
if (!etrack->offsets)
etrack->offsets = g_array_new (FALSE, TRUE, sizeof (GstMXFDemuxIndex));
/* We only ever append to the track offset entry. */
g_assert (etrack->position <= etrack->offsets->len);
g_array_insert_val (etrack->offsets, etrack->position, index_entry);
} else if (etrack->position == etrack->offsets->len) {
g_array_insert_val (etrack->offsets, etrack->position, index_entry);
}
if (peek)