From patchwork Mon Dec 13 07:21:31 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: 32403 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp5072322iog; Sun, 12 Dec 2021 23:22:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJy+x27sshiCflrGAgeBMyt5RlslLgERkRgEzjajGYdat6gOEpdYYf5kpgX3DeJnvE54N+Au X-Received: by 2002:a17:906:4c95:: with SMTP id q21mr41776574eju.485.1639380143012; Sun, 12 Dec 2021 23:22:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639380143; cv=none; d=google.com; s=arc-20160816; b=kovyLax4vLk/mCSGNFyJPHzi7BXZ8PquGPredBmP3v2qxcFMjeHz2Wy6Ee+mRMnP7x MPJhKHb51vIKmVOIDoWe/PfI0cvVUeo5ZVqyDpCh9Si5E1BVILUhG5kD+yOm24R//HbX nPdXuOqpScLaYKCO57x60bLO+WGu9pVOyGM1OmQpU6qtmE2n9LlxrPHOR6H9ajdNdlGv Ny60XjI1gWKg+LVBgPAc04pGP/KxCFjT+CFg0KnkkxPe6Vxdfm02fnI3E3pVWH2mY+wZ /GpMFTIJj7H4eZE7kh2plOf2cv5cH5A6XsdzptdNb/d/su7lXak9m2w+JpcyB0nJCVV7 GyXQ== 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=slgUZBS6UL2lBNj3PWgbBvhLzlsbCoDzXXxOtqCuX478TMxVIPcSXimpQt1QEomTqM pOhqheRJFPFqn99xkC8EpLONpLpuR83gwqfnaUyktEj8yGiKqlYhrJfOojc6X8brpTLx 0t7Kd6dUikQU3KNRrVEx4xZq8iKewobEBxr4w6OaFV1HAJxLq/6KIvkFjwJX+m32eGUw +OcHa3F+EbNPam96A6yYTJWgk6sMLFZKiwXGTn0NHygOgN86VvnZrwtVG0GWaSjzwD1o kS6krsEk/nCgbKcUgKMJdiLP/a1vY3g+91Zxvd67rE8Dc4WizM2Ev6u7hS5RgcrhObwX 5ajQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=PE6pyY1C; 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 ga42si20962841ejc.319.2021.12.12.23.22.22; Sun, 12 Dec 2021 23:22:23 -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=PE6pyY1C; 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 DA6BD68AF0A; Mon, 13 Dec 2021 09:22:17 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 85CD8680979 for ; Mon, 13 Dec 2021 09:22:10 +0200 (EET) Received: by mail-lj1-f182.google.com with SMTP id 13so22266166ljj.11 for ; Sun, 12 Dec 2021 23:22:10 -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=PE6pyY1CiNHG5t6d1BOBGN0fLtWQc/vpa3rFu3NzTIvH+X1gc5Xhwsckj4m1VSIooL dXf0fSaErIPmBSJL8gPk3EMmCTBfiCF7S2mCEHPX4oxSyj2LyL9m6e7xsHhd26LXT24s KEt2Lpz3l8fjIpExjWJ8B3xmR4OKOIn1Yx+Zz2vXz1Jq8lpzJs7yauLYaqPe/izmSSzP EMTQoynEa1/Y+lTkPOj+pnc8lC4lY69SN3oewORv/ZvqnVpTyCXyj8EKOOp2dUL7gQG9 0Nd6AyE4ZetTapBVDdZUvwpr/wLPtd8waf/9Zk0Ug+zDaEDKSeDV7I9Rejr2XCa6WJgv VUAw== 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=SuEZ7/3uJY3Ad4vC5D9u3zggjZXF3QSbpz8QHgblIYUXFUZjscYcTAcKKz1hFYfKYH K3zEsoRdIpxacL7fU30BazbEPqDg6lIZRz/NK7JDks48mzs4us/D36uj5lX+L1PDGtaa iAL9vNqq+Y7ql6QoJHdkWnNXu+n6/lpEvcrb5hnK5E1uiyVjGn1unc5isk9AqhGv2Hd6 xYsQ71LVZ/sRki6qQOvtyn5plgkIge4XPC083ll/26S8vB/FBtmW+VqmYd7kmEB0tJsZ FVop0t+LmYMhqw8egOdkQWSc74zI1Dlm1llC9coWY+4CErhkuG5HU/mo2gICddB3K506 nOJw== X-Gm-Message-State: AOAM532jqeWCR3N3xqbhBfonbFWu0Jq0n7WY6eKAc8jVjwW3iKtxAn4H nHfLk9lSUNJAUnfeLKvj//hDwoDT0jcjGA== X-Received: by 2002:a05:651c:2119:: with SMTP id a25mr28216533ljq.131.1639380129514; Sun, 12 Dec 2021 23:22:09 -0800 (PST) Received: from localhost.localdomain (84-217-56-54.customers.ownit.se. [84.217.56.54]) by smtp.gmail.com with ESMTPSA id t7sm1342357lfl.260.2021.12.12.23.22.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Dec 2021 23:22:09 -0800 (PST) From: Diederick Niehorster To: ffmpeg-devel@ffmpeg.org Date: Mon, 13 Dec 2021 08:21:31 +0100 Message-Id: <20211213072143.993-2-dcnieho@gmail.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20211213072143.993-1-dcnieho@gmail.com> References: <20211213072143.993-1-dcnieho@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v4 01/13] 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: xFk0NpfcHfUg 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 ||