diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2016-11-25 15:53:50 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2016-11-25 15:53:50 +0200 |
commit | 73e02f45535c5732028a8b44466384cf711b3e3e (patch) | |
tree | ad64aaa9cabb55c262eb16fcbb17ff505943049e /gst/mxf | |
parent | 9ff1ac59f3a05eb1436bc490178a0abee19730ae (diff) |
mxfdemux: Fix various logic errors in error handling of footer partition parsing
Diffstat (limited to 'gst/mxf')
-rw-r--r-- | gst/mxf/mxfdemux.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/gst/mxf/mxfdemux.c b/gst/mxf/mxfdemux.c index c808dc85e..a38c332d9 100644 --- a/gst/mxf/mxfdemux.c +++ b/gst/mxf/mxfdemux.c @@ -2333,13 +2333,11 @@ next_try: buffer = NULL; if (demux->current_partition->partition.header_byte_count == 0) { - if (demux->current_partition->partition.prev_partition == 0 - || demux->current_partition->partition.this_partition == 0) + if (demux->current_partition->partition.this_partition == 0) goto out; demux->offset = - demux->run_in + demux->current_partition->partition.this_partition - - demux->current_partition->partition.prev_partition; + demux->run_in + demux->current_partition->partition.prev_partition; goto next_try; } @@ -2348,10 +2346,10 @@ next_try: gst_mxf_demux_pull_klv_packet (demux, demux->offset, &key, &buffer, &read); if (G_UNLIKELY (flow != GST_FLOW_OK)) { + if (!demux->current_partition->partition.prev_partition) + goto out; demux->offset = - demux->run_in + - demux->current_partition->partition.this_partition - - demux->current_partition->partition.prev_partition; + demux->run_in + demux->current_partition->partition.prev_partition; goto next_try; } @@ -2366,9 +2364,10 @@ next_try: demux->offset += read; gst_buffer_unref (buffer); buffer = NULL; + if (!demux->current_partition->partition.prev_partition) + goto out; demux->offset = demux->run_in + - demux->current_partition->partition.this_partition - demux->current_partition->partition.prev_partition; goto next_try; } @@ -2380,10 +2379,10 @@ next_try: } else { gst_buffer_unref (buffer); buffer = NULL; + if (!demux->current_partition->partition.prev_partition) + goto out; demux->offset = - demux->run_in + - demux->current_partition->partition.this_partition - - demux->current_partition->partition.prev_partition; + demux->run_in + demux->current_partition->partition.prev_partition; goto next_try; } } @@ -2396,10 +2395,10 @@ next_try: gst_mxf_demux_pull_klv_packet (demux, demux->offset, &key, &buffer, &read); if (G_UNLIKELY (flow != GST_FLOW_OK)) { + if (!demux->current_partition->partition.prev_partition) + goto out; demux->offset = - demux->run_in + - demux->current_partition->partition.this_partition - - demux->current_partition->partition.prev_partition; + demux->run_in + demux->current_partition->partition.prev_partition; goto next_try; } @@ -2411,10 +2410,10 @@ next_try: if (G_UNLIKELY (flow != GST_FLOW_OK)) { gst_mxf_demux_reset_metadata (demux); + if (!demux->current_partition->partition.prev_partition) + goto out; demux->offset = - demux->run_in + - demux->current_partition->partition.this_partition - - demux->current_partition->partition.prev_partition; + demux->run_in + demux->current_partition->partition.prev_partition; goto next_try; } } else if (mxf_is_descriptive_metadata (&key)) { @@ -2441,13 +2440,13 @@ next_try: } /* resolve references etc */ - - if (gst_mxf_demux_resolve_references (demux) != + if (!demux->preface || gst_mxf_demux_resolve_references (demux) != GST_FLOW_OK || gst_mxf_demux_update_tracks (demux) != GST_FLOW_OK) { demux->current_partition->parsed_metadata = TRUE; + if (!demux->current_partition->partition.prev_partition) + goto out; demux->offset = - demux->run_in + demux->current_partition->partition.this_partition - - demux->current_partition->partition.prev_partition; + demux->run_in + demux->current_partition->partition.prev_partition; goto next_try; } |