From patchwork Thu Jun 23 07:24:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Jan_Ekstr=C3=B6m?= X-Patchwork-Id: 36389 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:1a22:b0:84:42e0:ad30 with SMTP id cj34csp3301575pzb; Thu, 23 Jun 2022 00:25:30 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uesVYv+jSzERWhSFUsePe4q2r9D89qGAUziLvTOTu9hIO2Ec1tG/IIwupF36GMeFNsrpED X-Received: by 2002:a05:6402:d0a:b0:425:d455:452 with SMTP id eb10-20020a0564020d0a00b00425d4550452mr8905184edb.259.1655969130571; Thu, 23 Jun 2022 00:25:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655969130; cv=none; d=google.com; s=arc-20160816; b=CAjjo9TUKAQNLfbuNu+eQVP6/zsp/ajiG/mMiHCY9/bxuF5RgWXg75+EQKDw2vQMJa 3Q0Y+UJdCiiihkWqKLkEgR8w+FFmaDNfYm+nX5Nv5eeIb6q9UdnQrJbIXjKch1l2XZJr 4GZtaiq/NOmZpIhDUPoRjVfb2gDQ9D12EW8H7VmamrLDAsDgtynh8cepD7iJ4rauf8IL hVeOQzHtTBLQEvwBWU4NRQNzvUNa+Ho9P1Qo4Mq0MHCUqNkGtEKYl284WZokFUyYoDmp 0IC7tFmnfgp+H3yl6yshxYU5tq2I7OmNtfk4AGgUzw3QrJJ4IBpLO3Roy8kZLMCC7U6l eI4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding: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=qrgnIMZxKHugV2yQ9zNtPKfRFtAo4nMCF3/GL53FHRM=; b=R1g5j/6cl/1dy39oh9qEXvCR68k0tGTc9dxUr/F4bg4tJB6P6W7AgBQntyKBifKUn5 SkKuQM8ewt5f3JN0M+EhewsaGeMUZvNVy7qfPeuauk6eEmFWdUO7eykU7n88VvtzyqHQ KLD51BoA6L18HqqG+9EfHaNxCIkYTlYZlLSogVldjtjsZjC+v35A9lTkUIh8pTLllMlt keYLBgvGryQyemvg22xO30ECNArJUEV4I18+BBCBtso9jUGlkKjtZPK26BZq1O+/ZgD9 KDvK39ts/IkmCc6ll3uZ7+4ZHE6Hg0RpAKCkU2vXGqOkWRmk+am7WmmPIQrrizE+rGWT yN+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=i8dSAUNP; 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 i29-20020a0564020f1d00b0043574f03987si15279331eda.39.2022.06.23.00.25.28; Thu, 23 Jun 2022 00:25:30 -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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=i8dSAUNP; 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 3878A68B743; Thu, 23 Jun 2022 10:24:29 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 34DA168B6F6 for ; Thu, 23 Jun 2022 10:24:20 +0300 (EEST) Received: by mail-lf1-f44.google.com with SMTP id j21so18728987lfe.1 for ; Thu, 23 Jun 2022 00:24:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=bH099dhZYI9uqdn/8sDYeksjgzgw9cAuU5G0EUDEpyE=; b=i8dSAUNP3GlUjm9qqm9NEVMOtTK3UTU7Wioaf1ujb2SOv5pqqhKXEdkzRvcSOc7Val 9kTFfsSSOMPDdV+FrWADNEbIzpQIEid9rR1r0qjkpVUbDIPePJyaclgVu/q76ib2irEH xdSUHZehjUx5wR3kDJalQJ8MReXYTcyWFXLthUCG9iUJk2cB583fPftJeIh5YFsz9G04 4X5O1DQlaD6/IutIEdwh2dzYIrT/pmM5GkauezjCmmnEPHK+QUNS7X4OnzYxQwQC4KRA w770wuZD0nVqxGD108EM3lSdNwyjV6JIisSu+oIHNUmkTATRM6QWs/S5vKdqcCQsiCA7 67uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bH099dhZYI9uqdn/8sDYeksjgzgw9cAuU5G0EUDEpyE=; b=0b/X9lpqHwDsBHfFpJF56AGIzNRHoWp1cuMD34m8ol1FVfqXc1qK4ny/rbEjhfVf4v 5G5CuIMhnG/LF9iFRvVje5DxAUUpry/RgzYqdn0QD3jZ2OW1S+uuG3Y1iY7hzu9k2XOq eThiXbR1T0PBehwAeVQLDlfPHRMiAXwWe5kHX9o1UWJDyEboOBkyIN+WNr/lg5ZVouw9 tSfBSY4BfGOS2ekuV9GeY0eoIPuZ3WKaWkUMRtfJXh3vP6+kHg+14oTArS1oFAC2YOUD 2wU9/4e32oDGUsWht0ymAhvvPq4i3IIjFB6qijseg9/4eXfQ1MqlL7KXCmKOAlvGcBTf 0gFA== X-Gm-Message-State: AJIora/6iECrFTSfzM1Lxmzc11zKX5CKX/AUU+gjggbz46UBogv9HymG iIrhEgGhhlWztFiSP480VGfVmrdeYew= X-Received: by 2002:a05:6512:1047:b0:479:7805:5f with SMTP id c7-20020a056512104700b004797805005fmr4696253lfb.238.1655969059598; Thu, 23 Jun 2022 00:24:19 -0700 (PDT) Received: from localhost.localdomain (91-153-198-187.elisa-laajakaista.fi. [91.153.198.187]) by smtp.gmail.com with ESMTPSA id a15-20020a056512200f00b0047f8ec3ca4esm732843lfb.87.2022.06.23.00.24.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 00:24:19 -0700 (PDT) From: =?utf-8?q?Jan_Ekstr=C3=B6m?= To: ffmpeg-devel@ffmpeg.org Date: Thu, 23 Jun 2022 10:24:07 +0300 Message-Id: <20220623072408.38977-7-jeebjp@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623072408.38977-1-jeebjp@gmail.com> References: <20220623072408.38977-1-jeebjp@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v4 6/7] avformat/movenc: handle OOM situations when parsing AC-3 headers 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: nFd03pVh/qhc From: Jan Ekström Signed-off-by: Jan Ekström --- libavformat/movenc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index a071f1cdd5..58ba0bc545 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -420,7 +420,10 @@ static int handle_eac3(MOVMuxContext *mov, AVPacket *pkt, MOVTrack *track) if (!info->pkt && !(info->pkt = av_packet_alloc())) return AVERROR(ENOMEM); - if (avpriv_ac3_parse_header(&hdr, pkt->data, pkt->size) < 0) { + if ((ret = avpriv_ac3_parse_header(&hdr, pkt->data, pkt->size) < 0)) { + if (ret == AVERROR(ENOMEM)) + goto end; + /* drop the packets until we see a good one */ if (!track->entry) { av_log(mov->fc, AV_LOG_WARNING, "Dropping invalid packet from start of the stream\n");