From 09c9cc0cc21e9c9f98eadee621651d8ca7afb2be Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 27 May 2024 01:52:27 +0200 Subject: [PATCH] avdevice/dshow: check ff_dshow_pin_ConnectionMediaType() for failure Maybe Fixes: CID1598557 Explicit null dereferenced Sponsored-by: Sovereign Tech Fund Reviewed-by: Roger Pack Signed-off-by: Michael Niedermayer (cherry picked from commit 2c2e72708831ca0cc76f72368676a8ccf624a2fe) Signed-off-by: Michael Niedermayer --- libavdevice/dshow.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c index 68478ca762..a40572b928 100644 --- a/libavdevice/dshow.c +++ b/libavdevice/dshow.c @@ -1545,7 +1545,10 @@ dshow_add_device(AVFormatContext *avctx, ctx->capture_filter[devtype]->stream_index = st->index; - ff_dshow_pin_ConnectionMediaType(ctx->capture_pin[devtype], &type); + if (ff_dshow_pin_ConnectionMediaType(ctx->capture_pin[devtype], &type) != S_OK) { + ret = AVERROR(EIO); + goto error; + } fmt_info = dshow_get_format_info(&type); if (!fmt_info) { ret = AVERROR(EIO);