summaryrefslogtreecommitdiff
path: root/libavdevice
diff options
context:
space:
mode:
authorDiederick Niehorster <dcnieho@gmail.com>2021-12-21 14:53:26 +0100
committerGyan Doshi <ffmpeg@gyani.pro>2021-12-24 14:04:14 +0530
commit7b21841ce45ef4ab486c3c94a714345b878a70fd (patch)
tree0a7965be4d1da57958e088e13f9b815f1b9c9f6d /libavdevice
parentbb813ccb458ea64a68feebcdfa76504fd6969f52 (diff)
downloadffmpeg-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.c3
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 ||