From patchwork Tue Jul 6 09:20:19 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: 28809 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5d:965a:0:0:0:0:0 with SMTP id d26csp4923295ios; Tue, 6 Jul 2021 02:27:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvmPvbvyKmACw0Q7a0wls5CqAuutOCIsN5jg3WYqPa8ML7f4yHkek4x8euUfAmOx7LFLbf X-Received: by 2002:a17:906:a019:: with SMTP id p25mr17610803ejy.483.1625563658317; Tue, 06 Jul 2021 02:27:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625563658; cv=none; d=google.com; s=arc-20160816; b=V3uK+QQ5RN5slXL+kJQ5uHM487ed2Gz0OzVz6kpc7u6Nld6ZUbfPoWCJDiz3Ek5Oqb J9vzmR/ZHSuSJOKMEviLSde8tOuwM0tiqUHnUghUkd8To51qKvHSd9LLzzBedtD9B4yR hmuQ2fgiA9O0S7VKFk9NtuE2LPs4Xk0KiI4rM5OcBRyLsEI3L+0qrACU4MG5J1NPScgk L5gh8pYA2NChz20KfNE2JY3J4GhgqqE7PHkAF7y+h/qPYljsjh9fHmYYxIZY8fgRUfmG Cf9MsrwvTYtQaIjLATnVRPItNml8kOKr0dQ2FrHsQ0aYlOQFOqXpXqIXSvDJiucHoC0t O7+g== 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=HYBAPkc9V7XLBqm/bTdG4VH12LxRvL0j3lmDRVLFELA=; b=G/L5gxZb9CckctGD26YN41aX37htD/7k/IQldDE7WG8qa5nOIw+JuuP3eEGAJot70d IqtrYqNv+8IB1Ac5zZy9EgCogWfLGbbk4GcjUyJK4pzlmUa4afP3RcGzH1gPQn61dZ9b B9augO9UbBtdm5qtJhWmZGmC3gpl0HeVDEy1bmI8miErmx59fbdefXDxaYUAAmFtaZ6t 5G1ekAt/rJRvvA3KJ3nUVQQO4sOUGhUeomdLCHp6xrLA3yMIaLivIelhX9c86nN4CSw+ j7NHz9iA+s6gVIQrklFfoSzMm7IMicAcBNKV9VjdgR1sdIvBX+xGapvC3G24Ep0GFJrV iueA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=cBARZlWs; 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 e8si15002809edz.556.2021.07.06.02.27.38; Tue, 06 Jul 2021 02:27:38 -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=@gmail.com header.s=20161025 header.b=cBARZlWs; 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 ED0A268A96A; Tue, 6 Jul 2021 12:27:16 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 741FA68A958 for ; Tue, 6 Jul 2021 12:27:15 +0300 (EEST) Received: by mail-lf1-f44.google.com with SMTP id p21so15438449lfj.13 for ; Tue, 06 Jul 2021 02:27:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PW6QcP3xG8rUlNSZPBtFabYTOQPmGGw1r30AnJrHSJA=; b=cBARZlWszQCtG8o2hVBcAo5ROT48WmE7REZ907Pr/EgREl810wp4JT2Zsmi2iXLmay PZY187uddIzGNGfxQaH5/AsP8r86PTV2p+SuKsT2yMq38k+VrnhW3JeoLKid972oaYwU Ap2M+Y06vvOTEekYfO6ekNQqCswQ/k+g3LeEK0Y2vYnRUYHt4kBv+DcyQi/mqtWLDK3c 5mGM7m4YoB1jdyjD6j+ZSX6VlPsluZKagyXA3dr9HKIsc7+thal7Bh1yDfPVOyLpTzqr Nz4CIoLGUR4EhzuuRt9hgzJcJAH3dG8EmmIjNS8tgN8fF3W0JaCgY5DUbpo3w+TV5HJ5 BjgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PW6QcP3xG8rUlNSZPBtFabYTOQPmGGw1r30AnJrHSJA=; b=Tn/yFnsMVKe99GxXNii/zk1t04RdepB+D+qU0Vvw27YTnRYa00MQydqNyd8N7NPfC+ 7DKJm7cB1m5fRkf9p4AoC7CQ/k8N4jx2o6yw1hCiJKoHCU56872kwCCt6NKqwlrQJQag n/roInkD2Ddw2vpLqLzwtgVF2AT1e/4hgX4LaBv+VDANUua1cigdQd2W9vB4uHQ4o/UQ 25nPFOJzWaN3YiZsmc1V/O0ZtB5SLHaEYpGG1+mS9gdWNb1KUBLJEemmScuLuAo7LGYl RF/6WmVsvBikyQ5E88yJ9viDubBZrgj+TDaxrp0eqagtb+MJDHkXDHrDKc2HKGwIDB8B xK7Q== X-Gm-Message-State: AOAM5338tdttWqgrgSXTRjjag22Vds6H5ybI6qOK/GqGq9ICgBTytCsS vbs4bKyybgXoCHkwD9DkuUYQ4GNLzL0= X-Received: by 2002:ac2:5c11:: with SMTP id r17mr2803825lfp.67.1625563634596; Tue, 06 Jul 2021 02:27:14 -0700 (PDT) Received: from localhost.localdomain (deedock.humlab.lu.se. [130.235.135.183]) by smtp.gmail.com with ESMTPSA id s5sm1800016ljj.18.2021.07.06.02.27.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jul 2021 02:27:14 -0700 (PDT) From: Diederick Niehorster To: ffmpeg-devel@ffmpeg.org Date: Tue, 6 Jul 2021 11:20:19 +0200 Message-Id: <20210706092020.1057-34-dcnieho@gmail.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20210706092020.1057-1-dcnieho@gmail.com> References: <20210706092020.1057-1-dcnieho@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 33/34] 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: IW2VjrSMXy2L list_options true would crash when both a video and an audio device were specified as input. Crash would occur on line 1588 (in this new rev) 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 f900e89988..a66f7b81fd 100644 --- a/libavdevice/dshow.c +++ b/libavdevice/dshow.c @@ -1519,9 +1519,9 @@ dshow_list_device_options(AVFormatContext *avctx, ICreateDevEnum *devenum, if ((r = dshow_cycle_devices(avctx, devenum, devtype, sourcetype, &device_filter, &device_unique_name, NULL)) < 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, ranges ? &device_pin : NULL, ranges, query_type)) < 0) return r; - av_freep(&device_unique_name); return 0; } @@ -2043,6 +2043,7 @@ static int dshow_read_header(AVFormatContext *avctx) } } } + // don't exit yet, allow it to list crossbar options in dshow_open_device } ctx->is_running = 0; if (ctx->device_name[VideoDevice]) {