mirror of https://git.ffmpeg.org/ffmpeg.git
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>
This commit is contained in:
parent
5b4baf1506
commit
2ba6d7cb82
|
@ -2000,6 +2000,8 @@ static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const ch
|
||||||
{
|
{
|
||||||
int i, err;
|
int i, err;
|
||||||
AVFormatContext *ic = avformat_alloc_context();
|
AVFormatContext *ic = avformat_alloc_context();
|
||||||
|
if (!ic)
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
ic->interrupt_callback = int_cb;
|
ic->interrupt_callback = int_cb;
|
||||||
err = avformat_open_input(&ic, filename, NULL, NULL);
|
err = avformat_open_input(&ic, filename, NULL, NULL);
|
||||||
|
|
Loading…
Reference in New Issue