diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-02-23 22:47:49 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-02-23 22:48:35 +0100 |
commit | 4d1b017c380e3794cd938009faab356390cbe0ad (patch) | |
tree | 7ca43b7258c53238ffbd33253ca5c5ecf883ef03 | |
parent | 03616af2c91309d58f9419becf45d292cb93e625 (diff) | |
download | ffmpeg-4d1b017c380e3794cd938009faab356390cbe0ad.tar.gz |
avformat/mov: Check av_add_index_entry() return value
Fixes NULL pointer dereference
Fixes: signal_sigsegv_b060e0_3794_cov_1293954059_vc1-wmapro.ism
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/mov.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index f70ec6169a..3d68ac80a3 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3218,9 +3218,12 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES)); if (keyframe) distance = 0; - av_add_index_entry(st, offset, INT64_MAX/2, sample_size, distance, - keyframe ? AVINDEX_KEYFRAME : 0); - st->index_entries[st->nb_index_entries - 1].timestamp = cts; + err = av_add_index_entry(st, offset, INT64_MAX/2, sample_size, distance, + keyframe ? AVINDEX_KEYFRAME : 0); + if (err < 0) { + av_log(c->fc, AV_LOG_ERROR, "Failed to add index entry\n"); + } else + st->index_entries[st->nb_index_entries - 1].timestamp = cts; av_dlog(c->fc, "AVIndex stream %d, sample %d, offset %"PRIx64", cts %"PRId64", " "size %d, distance %d, keyframe %d\n", st->index, sc->sample_count+i, offset, cts, sample_size, distance, keyframe); |