From patchwork Wed Jul 4 20:30:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 9620 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:104:0:0:0:0:0 with SMTP id c4-v6csp1162628jad; Wed, 4 Jul 2018 13:30:35 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeVhadfEaKHLjvzxc+6l/otXzYuLOyLmZYSadbAJWoGzOnBkeLiTOMhlF6VohBL93Pz3gdr X-Received: by 2002:adf:ec02:: with SMTP id x2-v6mr2374560wrn.245.1530736235075; Wed, 04 Jul 2018 13:30:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530736235; cv=none; d=google.com; s=arc-20160816; b=XVSJExE8YzMt3LWAlxfhmm02edTpEaKnmbOLJFq84N0+zAANiVfm/UUFr/OW5l2Hbv wm4qUvqrluscbZbkhDUOXsKcdBAZisczyAYeEf1LWCLdO8QSMkX+lP8I7Aw79jhL2cmL jDs7f8oexEEVSFlqeAFY5u2Uv0/C+UlOPYQv+jh+JngXu7uCw8ZvVmZpjSdTLSko94tI 0cdRr+s/N5d2uIS4Il9B/ZllxJDwuAyIa+sWlFZD+BnsXjTRJTzVUeZBnwZurwJcRWkS yZPUaSsdoouLpAbLwPtlVBuME1SRjdbc8T+9r0izZdi7ZYB8WAkAzDIDva3XPcIXCyGe 5dzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:delivered-to :arc-authentication-results; bh=EjMl5gshKfoNnyMr91KRKtoiCQ5/byVwtf7+hchhfng=; b=TuOo+GlmAPDbejjurhAZvJ6cWGE+VtOhh1lq0BkW2FvUL/te+m4VJoe4Up4/PdRBy4 YnzQjCekGBccdPsR1QZzuDV+bJrUx69Ti8y/P1OeiKdlZonTJ9AR2nPUbYr5Fxq7rDOY jjfaZmr7iLiYXr2rjRyGiwfFJmouJK6Rah2ndEg+fz/rUFFqT8Vs6Z4KLNdutdLU8wYL EMcYsHAmQQfhPBFLsBuAWG0/Rh8u00cPzT8krC25S75ZEUKnBgWMUPAvxYtzLAhD1hML vgZ5IGXwZbpv5bKAPAYrLcm4sDA2RqPkYyOUIsBCcjuz4a8Atpvneu9+UA6yWuo82Oef Ii4A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 194-v6si3405215wmx.22.2018.07.04.13.30.34; Wed, 04 Jul 2018 13:30:35 -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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4DA6068AB7D; Wed, 4 Jul 2018 23:30:29 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C0B9D68AB25 for ; Wed, 4 Jul 2018 23:30:27 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 5F9CCE056F; Wed, 4 Jul 2018 22:30:32 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vX9wabqwEo38; Wed, 4 Jul 2018 22:30:31 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 6263BE047F; Wed, 4 Jul 2018 22:30:31 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Wed, 4 Jul 2018 22:30:27 +0200 Message-Id: <20180704203027.23849-1-cus@passwd.hu> X-Mailer: git-send-email 2.16.4 Subject: [FFmpeg-devel] [PATCH] avformat/mxfdec: only return stream indexes which have a corresponding track 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: Marton Balint MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Without this check some crafted files might crash because a packet might be demuxed which have no corresponding mxf track. Signed-off-by: Marton Balint --- libavformat/mxfdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index b76beb962f..c52ece9655 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -423,7 +423,7 @@ static int mxf_get_stream_index(AVFormatContext *s, KLVPacket *klv, int body_sid return i; } /* return 0 if only one stream, for OP Atom files with 0 as track number */ - return s->nb_streams == 1 ? 0 : -1; + return s->nb_streams == 1 && s->streams[0]->priv_data ? 0 : -1; } static int find_body_sid_by_offset(MXFContext *mxf, int64_t offset)