From patchwork Tue Dec 21 13:53:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Diederick C. Niehorster" X-Patchwork-Id: 32791 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp5444142iog; Tue, 21 Dec 2021 05:54:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJz4XUDIt7h33e1MIYQ1R5D7SN270sZbB2BES4KBTmQ8aX7MAVuVGaHaweZs8NE/lNvDzO6i X-Received: by 2002:a17:907:7b9e:: with SMTP id ne30mr2866933ejc.24.1640094861795; Tue, 21 Dec 2021 05:54:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1640094861; cv=none; d=google.com; s=arc-20160816; b=tGTMNKDelfF4gg8Mo78IHdZ954x9YnMAk2oesQvL5SdMpQTlnkKrCd0VOWev7cocFH Q4lizw/keCK5pOUn5zzJHgtPCjKsQNHSc9710YYFnVi15YVpsqvAOYMZiidUd52KLQUm BbLSgUL+U4ILck48Bdja7eFmlc2DrCogGdNWGfu/jK38/VA/1fXRMZiOODHsV2S/cP9F bxAYr/iYhGB095kUOp/FxDPD5iiSOuUZzVPDIP8Vd/qDEFmymFxDZs9XSWiIkmf06hc4 JtpPCN69SeH8ugTXXXiywRXJLXJ/xR9FxqGrrw1TruRlkw8zJbcj0EzN56QE/HVuUg3D Jf0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc: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=m/s5EPvZLYo4YA+rc8/KGNmrJHguYkJqkJTYyTZicHs=; b=CzWX5dJeG7+LuGW8BxUqlMW/CXDGHepgiTh3MlmyoeRWIBpF8pxOsxBBI1DsRKVtOM GwFLwu0uZwM6MmU3saWwm2+rVYQNIxZrbNl/pKNWDq3RbF9v1tyETNibpwxCcwn5yXRp 7KntsanOeWTSyMoQHQoZVpOAQRwoeDJt5PkrwDJIVcko4XYBqBBaA+7hZaJsLD3y6zi2 uBpr/f6nwPhttanvRMUlZgoPItiPU4uRVZglAc8UFrb3+cpIvw/YMBzDPXzSFRRm/x/N 71A0zuIsfSFF0yWn1aaKmmeJjYnRQP4Z9Z0qm43Mvi6c7O0fY6xN8igch4E+qkD83Sp6 NCoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=ZyhtH3VI; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id nc5si16538755ejc.792.2021.12.21.05.54.20; Tue, 21 Dec 2021 05:54:21 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=ZyhtH3VI; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4B14168AF88; Tue, 21 Dec 2021 15:54:07 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DEAF768AC7B for ; Tue, 21 Dec 2021 15:53:59 +0200 (EET) Received: by mail-lf1-f53.google.com with SMTP id g26so13691772lfv.11 for ; Tue, 21 Dec 2021 05:53:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=n4ECdPBbt8xqX/bDaPPPd4LEZ+alPN7BkD4xWH+ML2s=; b=ZyhtH3VI25wz63r3pof9/n6sS4j/Vf3jbHUK+/Dm2v8ceP7u8FWv7a2yXPrs+hytRG /mnS71apZ6IlEflb5d3NH5574bnDyURhmDGaW9uxGN8DpNj3/5uUWJ2iXuquXfKbkKCB ZE/PVzUJA7zv8EfgduN/hC2cFZk9bqJeKhAEK/ZAeqBCtobhaiK4jIFHld7E8/JZaIvB U94pgDk32nUHLMcrD3geVLip0vZy4zXF78OeJt4+OnbkoqO8ag86mxrulcQsAuQwJC7v 0XqG03Tkd8cqSswwP7K85fWke3I+q9YuOf8XRhvXg6EkDzxhBr3xsZ46M/1xRGdg9wZw xcOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=n4ECdPBbt8xqX/bDaPPPd4LEZ+alPN7BkD4xWH+ML2s=; b=LqRQwbfSqwQPin4Kss4s9ehQtT1lAuSN9/dR4T1CFpzLNshaXkiEA2XK5B3InA5lmQ wCAIUhH2Vm9GB1f+9awEnk34DQJ2pFF/P+S+fhwuxkrRogFdkHqi37MAK9JueJZoPrQh c7rP2E7vb1nBA1ZXWVpQ2pcygruVdAk/EKIncYaKyVIlrlmC9I5BxAm2BowS+C8XOFQw EomiQtQZZguiziK+4ktH+BGLEImsX8X53ndX/ihDrI1Vq5GgHQXrt4zK1uLk69A9Z4QO d/OY2qE692FBWYM+Cq1Dog24Owbg+jNAyzrwdKqu/hPmrwJYBmRxMTjWK5giXoMsNdsR vtpw== X-Gm-Message-State: AOAM530+ObNC3fM0howZa8+WotIP1OBBFbhB2tOuIrVfEPcncVb4vGSn /gwJJ5GZAsCHgANtGwbZ4UhKrKHdo1rXNw== X-Received: by 2002:a05:6512:1194:: with SMTP id g20mr3110921lfr.58.1640094839044; Tue, 21 Dec 2021 05:53:59 -0800 (PST) Received: from localhost.localdomain ([196.244.192.13]) by smtp.gmail.com with ESMTPSA id e12sm990474lfr.179.2021.12.21.05.53.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Dec 2021 05:53:58 -0800 (PST) From: Diederick Niehorster To: ffmpeg-devel@ffmpeg.org Date: Tue, 21 Dec 2021 14:53:26 +0100 Message-Id: <20211221135337.1348-2-dcnieho@gmail.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20211221135337.1348-1-dcnieho@gmail.com> References: <20211221135337.1348-1-dcnieho@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v7 01/12] avdevice/dshow: prevent NULL access 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 Cc: Diederick Niehorster Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: T+Oo5J/LRtur 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 --- libavdevice/dshow.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 ||