From patchwork Sun Jun 14 22:36:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 20355 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 88E2A449042 for ; Mon, 15 Jun 2020 01:38:11 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7173A68B494; Mon, 15 Jun 2020 01:38:11 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A57E868B2E0 for ; Mon, 15 Jun 2020 01:38:04 +0300 (EEST) Received: by mail-wr1-f68.google.com with SMTP id h5so15196021wrc.7 for ; Sun, 14 Jun 2020 15:38:04 -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=4e3iCvjz1Cv5wvYkP+tONHBsRopuLU7UFZ14xgXBwng=; b=mIK7EpIZa/GtfFlJ0ZKWbtxmH01HL+1nyEnQ2WeGwpr9H55SOVO5gpwnGXwUS+fSXE p12SLyFTq9yiOfL8NGB1+O+0AceMvotWR4N47/N3ejOMs7713La53ycc/G7yLfV8bwmb RKo+avDXxAupLBUt3csXLx4HCvv0IExQkofYgdU62IozZ6NHN2pWS4izaUfiKuhUezxQ BYd/0sIVK9a84GyEOGNVHHg81S9flI6iSE4XykFAI5+sZupaCgzyfCTaAxFmlA2z5ue1 jRx5ExWYIppk3ZoAg8o3Tr6c3MKX5q9/6Efqhhk451yu/Cu+hiMHcjTxyEKAEBe+fPSP KUnw== 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=4e3iCvjz1Cv5wvYkP+tONHBsRopuLU7UFZ14xgXBwng=; b=SqV5222NeGAcCdW1AcHVmFOw871A7tOzodrZ0T3k+1aiYXu5xMOtCKBwhNDzAtC+fS ocjouqOGt1NVSmPl9a0JrwQ2eMVM7cOrx4jCXDP0o3P0+KtL6Fd/ylhJD+eZU2Ahll3c K65sa4DxyKddYdnGp8930+q9tYe7TH88LTsCbGwIaiVegu/Lp2Cavb2OKx8eImsNEeWq grsH5iumMV6auBVYKGURmlc7M6o+UtOxcjt/H5EEV4jh321OlZ1Uuw5yA+dFz7w7Egbc oW0+0YURqC8hkS7krrXkmjAbY6Gz2DiyTbMWV+M3j0O6+dck3E3qT/JBD9a+Q5J4k9FN 7nwQ== X-Gm-Message-State: AOAM533LU38X6fibtXLj2hDY3H1E039HZK3xmf3tiKhr+kyWCsfLsw7b vqrUFF6kyuSL/aO13V1RRZMbffIW X-Google-Smtp-Source: ABdhPJwQ70HDn23chTolxnE8RvO0QMoSY9NBBEuxFi2wBw5FROwmio3bF/kMTpLAyvdUerCnomQs9Q== X-Received: by 2002:a5d:6444:: with SMTP id d4mr26561278wrw.239.1592174283869; Sun, 14 Jun 2020 15:38:03 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1ab57.dynamic.kabel-deutschland.de. [188.193.171.87]) by smtp.gmail.com with ESMTPSA id z8sm21491034wru.33.2020.06.14.15.38.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jun 2020 15:38:03 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Jun 2020 00:36:33 +0200 Message-Id: <20200614223656.21338-3-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200614223656.21338-1-andreas.rheinhardt@gmail.com> References: <20200614223656.21338-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 03/26] avformat/matroskadec: Use right number of tracks X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" When demuxing a Matroska/WebM file, streams are added for tracks and for attachments, so that the array containing the former can be NULL even when the corresponding AVFormatContext has streams. So check for there to be tracks in the MatroskaDemuxContext instead of just streams in the AVFormatContext before dereferencing the pointer to the tracks. Signed-off-by: Andreas Rheinhardt --- libavformat/matroskadec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 1846b1f93c..d26375cdcc 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -4180,9 +4180,9 @@ static int webm_dash_manifest_read_header(AVFormatContext *s) av_log(s, AV_LOG_ERROR, "Failed to read file headers\n"); return -1; } - if (!s->nb_streams) { + if (!matroska->tracks.nb_elem) { matroska_read_close(s); - av_log(s, AV_LOG_ERROR, "No streams found\n"); + av_log(s, AV_LOG_ERROR, "No track found\n"); return AVERROR_INVALIDDATA; }