diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-11-11 20:57:45 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-11-11 20:58:04 +0100 |
commit | 5aedee4facb2295cfdeaf322bc67fd15323862d9 (patch) | |
tree | d0bc4b95697ce35d2ea6d1331d06a96033dd2322 /libavformat/gxf.c | |
parent | c871244306f92fecaaed8a97f47ba54d46eb0cd5 (diff) | |
download | ffmpeg-5aedee4facb2295cfdeaf322bc67fd15323862d9.tar.gz |
gxf: avoid null ptr deref without streams.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/gxf.c')
-rw-r--r-- | libavformat/gxf.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libavformat/gxf.c b/libavformat/gxf.c index 0286439c44..4088088eef 100644 --- a/libavformat/gxf.c +++ b/libavformat/gxf.c @@ -270,15 +270,16 @@ static void gxf_track_tags(AVIOContext *pb, int *len, struct gxf_stream_info *si */ static void gxf_read_index(AVFormatContext *s, int pkt_len) { AVIOContext *pb = s->pb; - AVStream *st = s->streams[0]; + AVStream *st; uint32_t fields_per_map = avio_rl32(pb); uint32_t map_cnt = avio_rl32(pb); int i; pkt_len -= 8; - if (s->flags & AVFMT_FLAG_IGNIDX) { + if ((s->flags & AVFMT_FLAG_IGNIDX) || !s->streams) { avio_skip(pb, pkt_len); return; } + st = s->streams[0]; if (map_cnt > 1000) { av_log(s, AV_LOG_ERROR, "too many index entries %u (%x)\n", map_cnt, map_cnt); map_cnt = 1000; |