Mercurial > libavformat.hg
changeset 3190:8b95e46003f8 libavformat
check frag track id before setting st
author | bcoudurier |
---|---|
date | Sun, 30 Mar 2008 20:49:29 +0000 |
parents | f016d69a28b6 |
children | 68c7fd8c44ca |
files | mov.c |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mov.c Sun Mar 30 19:17:01 2008 +0000 +++ b/mov.c Sun Mar 30 20:49:29 2008 +0000 @@ -1442,14 +1442,18 @@ static int mov_read_trun(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) { MOVFragment *frag = &c->fragment; - AVStream *st = c->fc->streams[frag->track_id-1]; - MOVStreamContext *sc = st->priv_data; + AVStream *st; + MOVStreamContext *sc; uint64_t offset; int64_t dts; int data_offset = 0; unsigned entries, first_sample_flags = frag->flags; int flags, distance, i; + if (!frag->track_id || frag->track_id > c->fc->nb_streams) + return -1; + st = c->fc->streams[frag->track_id-1]; + sc = st->priv_data; if (sc->pseudo_stream_id+1 != frag->stsd_id) return 0; if (!st->nb_index_entries)