From patchwork Thu Sep 5 20:16:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 14934 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 3BDC344879C for ; Thu, 5 Sep 2019 23:24:17 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 26EFF68799C; Thu, 5 Sep 2019 23:24:17 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1E2036809FF for ; Thu, 5 Sep 2019 23:24:10 +0300 (EEST) Received: by mail-wm1-f68.google.com with SMTP id o184so4555807wme.3 for ; Thu, 05 Sep 2019 13:24:10 -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=u7gaSvHmHPusnCvzeohTVoQxpD03mRDudp5taiyWX/A=; b=GeBYPk6ertk3Yy2iEuNEtewhDyapvRog/txQqBX2Q9DswYdfdvkrd4IIQOgLPps92e KjqNRBUv0PkEBiYZKY2D+bcugrAa/QD5Evhm6KZkrzIolSoLQ2xND7a0v2wxw0JjuGQC jhWYNAzxAlE0XfQ8L+aeFw573v9cKnF2aVGaW+CJeayecn6nIZn6E/IJ6/JeK6TikuiK piT3R3PXAeIEP2kK3Z1Hau65Rcbe3VpWGXrOdZ6zcTn79HMKvh614XyJvUd9Lp5/J4Nx KwE6RE8+c+37M5syMWz8/ev2fJpU5nlDuMSwOYDGgrWzCPPZJgjpRaK7pfBkKhOFw59P UZZA== 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=u7gaSvHmHPusnCvzeohTVoQxpD03mRDudp5taiyWX/A=; b=VHLG13b2bn+dP6k1wYGY2aQCfsBb1VRQPcN7lM63kupQBVt7+szOjasdQgRoZbO1Yw m4v8/Nru7weuyYDP4b2EMfm7c5jaHYlMFaV7dR+aTsf0oRLut6gLoQ6/z817+CuRdNvD dIzPSP4T80iMqEISET1NLMfoEXONnXYUs+Ie/Xiv8WG/oiPV0X8kUvDwSAte4dPa78WU XBuRntTbeiiwR7ecarCOnKNT3+/wJrxlunqCRgSs73C474RAHo6Olk0MbWq5KJjzjzn4 L1/B1dawEbOC4kAFaYyOLCH0TH3IPHFecqxcEUIFgHXZKAUMc8sjRLco3+SFI0Nnlzkl qFcw== X-Gm-Message-State: APjAAAXOoTR+7YTc/6KM/nka6c4A214IXEkNLNJu8WXEOzGhC+/ljDV4 pocqniP1f2iaCl/+NVhdscOoRrFmcb4= X-Google-Smtp-Source: APXvYqyjF426V1FF4nBZj64mD+xCB82iYiVE3aH8D6q/RGtIpk3M4d5EJKTq5u3bIXLlg3WcrW/odg== X-Received: by 2002:a05:600c:cf:: with SMTP id u15mr4673346wmm.168.1567715049469; Thu, 05 Sep 2019 13:24:09 -0700 (PDT) Received: from localhost.localdomain (ipbcc0f857.dynamic.kabel-deutschland.de. [188.192.248.87]) by smtp.gmail.com with ESMTPSA id g201sm5889769wmg.34.2019.09.05.13.24.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Sep 2019 13:24:08 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 5 Sep 2019 22:16:07 +0200 Message-Id: <20190905201609.998-6-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190905201609.998-1-andreas.rheinhardt@gmail.com> References: <20190905201609.998-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 6/8] 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index e5c7a6b29d..075ed63f00 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -4194,7 +4194,7 @@ 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"); return AVERROR_INVALIDDATA;