aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-09-28 16:14:08 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2016-10-05 03:06:45 +0200
commit239f75d6c3dfbe4def80a12913d5737dd5a5bbcc (patch)
treec015175224315a26f4a4215d3cc8e0c716d9469e
parenta772613100514842008271c8d0e5d63a6979f9bf (diff)
downloadffmpeg-239f75d6c3dfbe4def80a12913d5737dd5a5bbcc.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> (cherry picked from commit 2679ad4773aa356e7c3da5c68bc81f02a194617f) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/avidec.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 0ffe9908eb..d2904ab7d2 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -1090,6 +1090,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);
*st->codec = *ast->sub_ctx->streams[0]->codec;
ast->sub_ctx->streams[0]->codec->extradata = NULL;