OSDN Git Service

mxfdec: Make sure x < index_table->nb_ptses
authorTomas Härdin <tomas.hardin@codemill.se>
Thu, 26 Jan 2012 12:21:31 +0000 (13:21 +0100)
committerDiego Biurrun <diego@biurrun.de>
Thu, 9 Feb 2012 11:40:34 +0000 (12:40 +0100)
Avoids a SIGSEGV on files with IndexEntryCount < IndexDuration.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
libavformat/mxfdec.c

index 96b662f..d7f3c5e 100644 (file)
@@ -1113,6 +1113,13 @@ static int mxf_compute_ptses_fake_index(MXFContext *mxf, MXFIndexTable *index_ta
             int offset = s->temporal_offset_entries[j] / index_delta;
             int index  = x + offset;
 
+            if (x >= index_table->nb_ptses) {
+                av_log(mxf->fc, AV_LOG_ERROR,
+                       "x >= nb_ptses - IndexEntryCount %i < IndexDuration %"PRId64"?\n",
+                       s->nb_index_entries, s->index_duration);
+                break;
+            }
+
             index_table->fake_index[x].timestamp = x;
             index_table->fake_index[x].flags = !(s->flag_entries[j] & 0x30) ? AVINDEX_KEYFRAME : 0;