aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/avidec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-09-28 16:14:08 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2016-09-28 16:46:24 +0200
commit2679ad4773aa356e7c3da5c68bc81f02a194617f (patch)
tree56c7e3f2164df097f9ad0a8ef38b6b5d48e67554 /libavformat/avidec.c
parent14bac7e00d72eac687612d9b125e585011a56d4f (diff)
downloadffmpeg-2679ad4773aa356e7c3da5c68bc81f02a194617f.tar.gz
avformat/avidec: Check nb_streams in read_gab2_sub()
Fixes null pointer dereference Fixes: 1/null_point.avi Found-by: 连一汉 <lianyihan@360.cn> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/avidec.c')
-rw-r--r--libavformat/avidec.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 96edfa88ea..2c81267e12 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -1101,6 +1101,8 @@ static int read_gab2_sub(AVFormatContext *s, AVStream *st, AVPacket *pkt)
goto error;
if (!avformat_open_input(&ast->sub_ctx, "", sub_demuxer, NULL)) {
+ if (ast->sub_ctx->nb_streams != 1)
+ goto error;
ff_read_packet(ast->sub_ctx, &ast->sub_pkt);
avcodec_parameters_copy(st->codecpar, ast->sub_ctx->streams[0]->codecpar);
time_base = ast->sub_ctx->streams[0]->time_base;