diff options
author | Diederick Niehorster <dcnieho@gmail.com> | 2021-12-21 14:53:26 +0100 |
---|---|---|
committer | Gyan Doshi <ffmpeg@gyani.pro> | 2021-12-24 14:04:14 +0530 |
commit | 7b21841ce45ef4ab486c3c94a714345b878a70fd (patch) | |
tree | 0a7965be4d1da57958e088e13f9b815f1b9c9f6d /libavdevice | |
parent | bb813ccb458ea64a68feebcdfa76504fd6969f52 (diff) | |
download | ffmpeg-7b21841ce45ef4ab486c3c94a714345b878a70fd.tar.gz |
avdevice/dshow: prevent NULL access
list_options true would crash when both a video and an audio device were
specified as input. Crash would occur on line 784 because
ctx->device_unique_name[otherDevType] would be NULL
Signed-off-by: Diederick Niehorster <dcnieho@gmail.com>
Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
Diffstat (limited to 'libavdevice')
-rw-r--r-- | libavdevice/dshow.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c index ef78781865..cc0bef0474 100644 --- a/libavdevice/dshow.c +++ b/libavdevice/dshow.c @@ -708,9 +708,9 @@ dshow_list_device_options(AVFormatContext *avctx, ICreateDevEnum *devenum, if ((r = dshow_cycle_devices(avctx, devenum, devtype, sourcetype, &device_filter, &device_unique_name)) < 0) return r; ctx->device_filter[devtype] = device_filter; + ctx->device_unique_name[devtype] = device_unique_name; if ((r = dshow_cycle_pins(avctx, devtype, sourcetype, device_filter, NULL)) < 0) return r; - av_freep(&device_unique_name); return 0; } @@ -1143,6 +1143,7 @@ static int dshow_read_header(AVFormatContext *avctx) } } } + // don't exit yet, allow it to list crossbar options in dshow_open_device } if (ctx->device_name[VideoDevice]) { if ((r = dshow_open_device(avctx, devenum, VideoDevice, VideoSourceDevice)) < 0 || |