[FFmpeg-cvslog] mxfdec: Make sure mxf->nb_index_tables > 0 in mxf_packet_timestamps()

Tomas Härdin git at videolan.org
Fri Feb 10 01:47:54 CET 2012


ffmpeg | branch: master | Tomas Härdin <tomas.hardin at codemill.se> | Thu Jan 26 13:21:32 2012 +0100| [29fc8f50cd35f83ab3472509835881bc96035e6a] | committer: Diego Biurrun

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: Diego Biurrun <diego at biurrun.de>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=29fc8f50cd35f83ab3472509835881bc96035e6a
---

 libavformat/mxfdec.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index d7f3c5e..f995844 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -1764,6 +1764,11 @@ 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)
@@ -1845,6 +1850,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];
 



More information about the ffmpeg-cvslog mailing list