From patchwork Sun May 26 23:52:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 49284 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:542:0:b0:460:55fa:d5ed with SMTP id 63csp2958772vqf; Sun, 26 May 2024 16:53:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXjG0rm03FMxKXUb2p9pqs0MBQ+FnKLYuZQKHSh1xYZ/xCk3xo2+IYV+yo3dYV6hIpq6zQ6nvul11PSiQO9cqW0d3nriejb0kgpFw== X-Google-Smtp-Source: AGHT+IGbm/K2PUMOiRvDWN0paqE4kolQZfszzNryZJMC/TN2Uau/bDsDeYb3eSYFoCtaU7z7wQmJ X-Received: by 2002:a17:906:35d8:b0:a5a:5c98:c595 with SMTP id a640c23a62f3a-a626511a554mr874879266b.61.1716767627900; Sun, 26 May 2024 16:53:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716767627; cv=none; d=google.com; s=arc-20160816; b=xjX/RMy2nTOR4MzdRXEtR21Xof9ZeJbiytesywx9gZZEegz6Ryfl2jNGOiwUbnTg9y VmDWoFi2+4bZEnFBTovfa2dKLxUtxxlLvNg0gzMmsuHPDBOXq6cwmf6+Ew3GeG8mX69S v/AyFlNRO9cP4/kk1m5XBYdk/INeW/0YPM+Ke2lJy5atlOgbFY1pUSn1LA7Wx3GbAoBJ HY2BuTE8IFJ8iu13kOBDh2Dn2m8dffriseimUeL1CtzI39OLrrQbG56K2+nT+rMcVyUT VDl5QgVc+X96Ciy6u+Ew8yyPP0VlU22O4WbJokvSBN+5vsQNlqw94eDi54qwAkJA7IMz /i2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=K8PgzxMdxMVABxf3TtIjlrGgQ2i0hQZMhcZ90ac/Kz0=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=M8aORfampKESvTM25QAoDKklFnPgK2qkesAUu4swu4dkoMl6HgYdiQ0OYQJqyX+Gi9 UArF69cWXqSVTvqQ356JTNOd1P6CwkhsAhKM2WzsHNupAnDYsrCPWEBeyn4p/5/rbhbv 82oXr7nMBORSyZqlqnz3yIhEJ4haGrBQGvOHNYJ6xzoGENyuWKXS0WXZJDIrgdrOCd1f R8LuadeFdWB9sdvHEqqS+DVCkelztd+YpbJ9y+/sJ7lXqHfiXqzdMSIuhM/WVfD6MIDr 9udsjsyUncNgCQE8aUIE5yc7IkDGJRz41dxhKmS6VwdtaBcy29XxqWAFZe1BcmV+U+Is NYYw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=Ey7uKPVc; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a640c23a62f3a-a62b9424badsi186586766b.636.2024.05.26.16.53.47; Sun, 26 May 2024 16:53:47 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=Ey7uKPVc; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 24D2868D5B5; Mon, 27 May 2024 02:52:49 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5868A68D542 for ; Mon, 27 May 2024 02:52:42 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 8C5E720004 for ; Sun, 26 May 2024 23:52:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1716767561; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7ZK32Gw31Yjt8tf8k8l4uegmqHnX32xHC9wbx7xKzFY=; b=Ey7uKPVcSEAFHbsyJUU0ZLTUy4GnAerotAlKEomfwzvgJpcnhK0mjvb2WSIqJgpRj1dcp0 OFYZ9IwhKaGYrLWXyb9ZnRZ9GYA5Ewn+lVNf2sIkezp/9e5E7cPLSSFUwOjP74JRhLYyQt BIJY2Mi/xdgcmI/jwwhnnI+hLxJNNn/cEe5LokfCh5THUEEprv3Qk6X7b6VVe0iBnnLozg 8B003gegWTSxxEN6nlhn8NlgDBqUEcsfadSOdu+fONa6MqXBGF5CdUTl4Xj1RSEf7wP/MO phxjMlSxxo0OHOM/Nku19EINahzFIhTbNA2vf7gWEDrd6IqQkFXSldvFUdfd8w== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 27 May 2024 01:52:24 +0200 Message-ID: <20240526235230.2876318-12-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240526235230.2876318-1-michael@niedermayer.cc> References: <20240526235230.2876318-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 12/17] avdevice/dshow: Check device_filter_unique_name before use X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: zzx5wVYooHin Fixes: CID1591931 Explicit null dereferenced Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer --- libavdevice/dshow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c index fd9027b1787..911b0ecc078 100644 --- a/libavdevice/dshow.c +++ b/libavdevice/dshow.c @@ -1373,7 +1373,7 @@ dshow_open_device(AVFormatContext *avctx, ICreateDevEnum *devenum, if (ctx->device_filter[otherDevType]) { // avoid adding add two instances of the same device to the graph, one for video, one for audio // a few devices don't support this (could also do this check earlier to avoid double crossbars, etc. but they seem OK) - if (strcmp(device_filter_unique_name, ctx->device_unique_name[otherDevType]) == 0) { + if (!device_filter_unique_name || strcmp(device_filter_unique_name, ctx->device_unique_name[otherDevType]) == 0) { av_log(avctx, AV_LOG_DEBUG, "reusing previous graph capture filter... %s\n", device_filter_unique_name); IBaseFilter_Release(device_filter); device_filter = ctx->device_filter[otherDevType];