diff options
author | Pan Bian <bianpan2016@163.com> | 2017-11-27 09:12:54 +0800 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-11-28 01:18:22 +0100 |
commit | 2ba6d7cb8278970bb9971448706c1e44ba043a81 (patch) | |
tree | 4c1c2f215a7d90a8fd6dd2635c0ea8ce72ab881b | |
parent | 5b4baf1506277863e9c1fa4bd302a4653e859669 (diff) | |
download | ffmpeg-2ba6d7cb8278970bb9971448706c1e44ba043a81.tar.gz |
ffmpeg: Check read_ffserver_streams() return value
The function avformat_alloc_context() will return a NULL pointer on
failure. However, in function read_ffserver_streams(), its return value
is not validated and the subsequent dereference may result in a bad
memory access bug. Check its return value against NULL and avoid
potential NULL dereference.
Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | fftools/ffmpeg_opt.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 9445a2dd11..672054223a 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -2000,6 +2000,8 @@ static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const ch { int i, err; AVFormatContext *ic = avformat_alloc_context(); + if (!ic) + return AVERROR(ENOMEM); ic->interrupt_callback = int_cb; err = avformat_open_input(&ic, filename, NULL, NULL); |