From patchwork Tue Dec 21 12:12:28 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: 32778 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp5360316iog; Tue, 21 Dec 2021 04:13:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJxQbqVDZ+Q7h9Tffm3gddIC7SU4I5DDb4HvYOUh1LC6F9taX5WDSld41sAcrhZkFMwS8EgU X-Received: by 2002:a05:6402:5106:: with SMTP id m6mr1378707edd.169.1640088797140; Tue, 21 Dec 2021 04:13:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1640088797; cv=none; d=google.com; s=arc-20160816; b=ciBHmrw5wRuNzsIgvteO8RPYKvaefhkt0iclg2Mw0mpJAo6HZSGDaqZ+N5DQpQ25Zy pBRvAvp0rvkxXQHGnRW19MP1k+N7GMybcyLQSsYvedn2UyfDedatlI3gzxGsKzXGMAvg ZQCyZRluc93NCrG5rAk7tTJqhw70n4naOVazok1VsNAHJm54iNWMXhMvYh3JcrPTfsLs vFgqADHLKqg7kH0O6Qvw0/4IrY5x1xSF4hhL+ojB583i5Q/DBv/ltMKX6a+9bAtsx2qV z3x5pm+LiIWyji7VuhKYDyV/EJs5QsRkb9rxT6UO3XeBcBzSqbNWlbaaW4C83LXLDT62 LQhA== 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=QW1NdeKTdJmjPjL5jGg2Rlwibr+AWQfuV9gdvj1qW33x9odTJEaYrB/w+loY28lv+T tEx3nKJrTpzSfjzCxMgfGBzBMm75PSGfdvOt3xdPMj0c/oir+KFQlcrUUChRpN93F1xO Z5wy9FnSMYHFtrKB+LF5PjcZE/9zRXNH5zM0eOlPmXsCRl5tbBVCarQlp6V0tdBlpZt0 mBc8uZVlynDkBhbc0tLn686brSRobfumzW+hQxE6MiWMKFOos6FsaRuEZFl9+pBRelxH 2iOKVJ/mmhQx6GBcjqT0w59nZZR67W5YW+95gDq7SApp3yTubmucbRZFe74qAubpe6yI 7qCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=AvnK3ci6; 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 o1si3340167edc.214.2021.12.21.04.13.16; Tue, 21 Dec 2021 04:13:17 -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=AvnK3ci6; 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 A660C68AEDD; Tue, 21 Dec 2021 14:13:08 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9800268AE95 for ; Tue, 21 Dec 2021 14:13:01 +0200 (EET) Received: by mail-lf1-f46.google.com with SMTP id g26so13050993lfv.11 for ; Tue, 21 Dec 2021 04:13:01 -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=AvnK3ci6hNOhWxThDfN2Bhrpawvtfpcgh/HNlvO+Xt/Fk+UYY/b9ikIdU2nH0sxXfc AU1ghM9neafM3XruwpCLhXqvUbnO6Fv1dKAV2DviA9E/JMPkfdQvNp/5v4FpgqU77GEY NBj1y3IgALLjNZTSr3EBeUPkUQDAXFRhbLtxUl7BwmXy+DQJJ0mYsLMAavSg6MpMeGXo DEijy14XJctx4Fuw4sDptQivoaLeC3jVfDaG3c0aGPiSrAAvhN0C7NkLwk5W7SNCqLzJ htZ4OZbQu+RIwnMBqJA2pMDnZCRM+STEUkkhARYowzcTqnoVV61pLMST5vaan9CKdDvn GgcQ== 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=ogZLCaVcAzJ7cuVx1CgmzlH5V7LvCpiQbwQBFKN2BzR7YO0A8Eu+lmeJceWKYVFl5n qpXi+kSbaxrP5T0ffyMNofXnR1HDQokAtULmlG4NpO/C3v0t4exr0TZb48FYNsnYrKS7 BhcO5JxCkL4UwZjsgGLVr9rWLpy4c3jqfbfiMfqTQgl95rB+x8DXN6rPdxcloCFe1VcL BvE1q1clo7Y9+cFcJhN7KeAvbhoooOHVxQg10sTq8F7q+KTW7Y63ctmTqOrPdD9icJQ8 /pEsRZ3OecANSiTdRpmqvveQ0oiktJoNEHq9sZNRjfNaNnthyqIGw5/of6ikHAe/n3fa M1JQ== X-Gm-Message-State: AOAM530ht/1IHEAHSDjDYYYR5HA/fJKBRPZaYlpfAwOSkUuUXVo36gBH 7ulhU5NcqHKusOIEDJefKZ39YFCo4qBRYg== X-Received: by 2002:a05:6512:3b13:: with SMTP id f19mr2763696lfv.305.1640088780761; Tue, 21 Dec 2021 04:13:00 -0800 (PST) Received: from localhost.localdomain ([196.244.192.13]) by smtp.gmail.com with ESMTPSA id p4sm245760lfo.9.2021.12.21.04.13.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Dec 2021 04:13:00 -0800 (PST) From: Diederick Niehorster To: ffmpeg-devel@ffmpeg.org Date: Tue, 21 Dec 2021 13:12:28 +0100 Message-Id: <20211221121239.1201-2-dcnieho@gmail.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20211221121239.1201-1-dcnieho@gmail.com> References: <20211221121239.1201-1-dcnieho@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v6 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: EMX0RGycGn/y 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 ||