summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-02-17 23:44:49 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-02-23 15:03:03 +0100
commitc8d363a3593a6ba5390ebecde720b71fbc4d6fbb (patch)
tree167a90993f4f5991c602d0fc9896ddde2ae94137
parentd0d441b35053e04bbca2149cbf08f14499a1619c (diff)
downloadffmpeg-c8d363a3593a6ba5390ebecde720b71fbc4d6fbb.tar.gz
avformat/bink: Check return value of av_add_index_entry()
Fixes null pointer dereference Fixes: cdbf15cbd0a27cee958dd0b8800e452e-signal_sigsegv_737991_2083_cov_317652874_LBSTART.BIK Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit c57fc97e956a52edc94a38ff0ecd3058b44c15b7) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/bink.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/bink.c b/libavformat/bink.c
index 6db73cce3a..b9c853cb14 100644
--- a/libavformat/bink.c
+++ b/libavformat/bink.c
@@ -79,6 +79,7 @@ static int read_header(AVFormatContext *s)
uint32_t pos, next_pos;
uint16_t flags;
int keyframe;
+ int ret;
vst = avformat_new_stream(s, NULL);
if (!vst)
@@ -177,8 +178,9 @@ static int read_header(AVFormatContext *s)
av_log(s, AV_LOG_ERROR, "invalid frame index table\n");
return AVERROR(EIO);
}
- av_add_index_entry(vst, pos, i, next_pos - pos, 0,
- keyframe ? AVINDEX_KEYFRAME : 0);
+ if ((ret = av_add_index_entry(vst, pos, i, next_pos - pos, 0,
+ keyframe ? AVINDEX_KEYFRAME : 0)) < 0)
+ return ret;
}
avio_skip(pb, 4);