From patchwork Thu Jul 9 10:35:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 20908 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 E53F544B499 for ; Thu, 9 Jul 2020 13:37:17 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CBFE568B5CB; Thu, 9 Jul 2020 13:37:17 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3065668B5BF for ; Thu, 9 Jul 2020 13:37:10 +0300 (EEST) Received: by mail-wr1-f65.google.com with SMTP id f7so1825612wrw.1 for ; Thu, 09 Jul 2020 03:37: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=HeslXwNlZuT44xvtTzsUPwBe0dWYR2oGbKKcjjxXpIU=; b=hqzCXbHJG8JxJVunao4jA73ax8xUq3ycaQrWyzr2VyR1P1davXMBEPDuM+8ek8Trnx ubpks8dnnZje6D0D3LllkEbWMtl1elSxjCyGYkdq+U0Er5UO6180231mcsyaOd0stAGk 6arPhi31pE8oLzApofjog5E34K1xG4tFfDi2p427uan8Ctn/T6gcarj4fd5VMZQIxGzL PM2RRyO/uaEuSi00cpTKRhJIysBO/RqRsSSSK/DZMra23RWHYA2uLTR4ULjrJqeOr7yj PWMJP5iTwjOLaY8yiaf40FMLs1OJlVGsesU6gshgqk5/vo6uwhprqzCC4Fsqb7dlzgjT uJvA== 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=HeslXwNlZuT44xvtTzsUPwBe0dWYR2oGbKKcjjxXpIU=; b=umA0Nd8daUf3wOhJ6eFzQu5g8SsiaKrQXwwUYxRvI/9Zt89jY+89isRBy1a/pZ7TG5 5px2OrGitX58Y1wxDATSuHLpphZcHdKeuQchw98uo5IZB1m+AoqPL8+gBjimUPPZvdir ZzqWmnn4kDNFk0JJE/Gq8QaZmCWqLCEUeUKEbTQpImLA5JbV1W8MrzdC4bxtW9TWx0gA Pt+J3P60YyvjoCWENjwsIc8dCqyqdx3hjj4cjhYH45NM9yVX1yo8yVSQDQ4NwVnrm7Uy 6GWqvthRWZ/cGs9NWe0BPyiVMGuA7/HyS2IXlbo4UJvpSQbTkJ+smOXGNQZ/HrMcrHJ0 Ojng== X-Gm-Message-State: AOAM533v3zgUO46IE2HzWQy7C7CBgfIY92J62JRrLqJoAC/LaUIarqoo wbw3AfYi8s69yQmqDYTVHffNeTP7 X-Google-Smtp-Source: ABdhPJw9auOhmwiINPjqoWFnax/esAthLvT6keUZHoS009++3SYGNtb5dxnwyL77OhZzJBNvZ1ZhXw== X-Received: by 2002:adf:f5ce:: with SMTP id k14mr59824192wrp.234.1594291029384; Thu, 09 Jul 2020 03:37:09 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc10296.dynamic.kabel-deutschland.de. [188.193.2.150]) by smtp.gmail.com with ESMTPSA id c15sm4155623wme.23.2020.07.09.03.37.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 03:37:08 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 9 Jul 2020 12:35:39 +0200 Message-Id: <20200709103542.19909-4-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200709103542.19909-1-andreas.rheinhardt@gmail.com> References: <20200709103542.19909-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/7] avformat/mm: Check for existence of audio stream 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" No audio stream is created unconditionally and if none has been created, no packet with stream_index 1 may be returned. This fixes an assert in ff_read_packet() in libavformat/utils reported in ticket #8782. Signed-off-by: Andreas Rheinhardt --- libavformat/mm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/mm.c b/libavformat/mm.c index d40fd12acc..02ffbcd824 100644 --- a/libavformat/mm.c +++ b/libavformat/mm.c @@ -175,6 +175,8 @@ static int read_packet(AVFormatContext *s, return 0; case MM_TYPE_AUDIO : + if (s->nb_streams < 2) + return AVERROR_INVALIDDATA; if ((ret = av_get_packet(s->pb, pkt, length)) < 0) return ret; pkt->stream_index = 1;