aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorTomas Härdin <tomas.hardin@codemill.se>2011-12-20 11:22:23 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-12-21 00:03:43 +0100
commit7feb7f16a80a8d8754d2b32228f08470ecee2dca (patch)
treec970a58b5225d689cd62b4daecbba8d322b96969 /libavformat
parentf27930cd9a2d4970b182024a42a9f5103c942f21 (diff)
downloadffmpeg-7feb7f16a80a8d8754d2b32228f08470ecee2dca.tar.gz
mxfdec: Make sure mxf->nb_index_tables > 0 in mxf_packet_timestamps()
Only the OPAtom demuxing logic is guaranteed to have index tables, meaning OP1a files that lack an index would cause SIGSEGV. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mxfdec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 3a0962429c..2e5a03936e 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -1703,6 +1703,10 @@ static void mxf_packet_timestamps(MXFContext *mxf, AVPacket *pkt)
int64_t next_ofs;
MXFIndexTable *t = &mxf->index_tables[0];
+ /* this is called from the OP1a demuxing logic, which means there may be no index tables */
+ if (mxf->nb_index_tables <= 0)
+ return;
+
/* find mxf->current_edit_unit so that the next edit unit starts ahead of pkt->pos */
for (;;) {
if (mxf_edit_unit_absolute_offset(mxf, t, mxf->current_edit_unit + 1, NULL, &next_ofs, 0) < 0)
@@ -1784,6 +1788,7 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt)
return mxf_read_packet_old(s, pkt);
/* OPAtom - clip wrapped demuxing */
+ /* NOTE: mxf_read_header() makes sure nb_index_tables > 0 for OPAtom */
st = s->streams[0];
t = &mxf->index_tables[0];