From patchwork Wed Sep 7 15:06:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 37741 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp3967115pzh; Wed, 7 Sep 2022 08:06:53 -0700 (PDT) X-Google-Smtp-Source: AA6agR5+UmayguON6uz28UBoAbmn131HBbJfFD39yMfj4Nh1Z+fZNQToHEmphKVpN2Gx/8xQedrp X-Received: by 2002:a17:907:94c2:b0:73d:c534:1ac0 with SMTP id dn2-20020a17090794c200b0073dc5341ac0mr2683828ejc.461.1662563212785; Wed, 07 Sep 2022 08:06:52 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id ne25-20020a1709077b9900b007317756bc04si14415290ejc.1006.2022.09.07.08.06.31; Wed, 07 Sep 2022 08:06:52 -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=@outlook.com header.s=selector1 header.b=rc+nbyey; arc=fail (body hash mismatch); 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=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AF27668BB9B; Wed, 7 Sep 2022 18:06:28 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-oln040092074023.outbound.protection.outlook.com [40.92.74.23]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 26BC968BA1A for ; Wed, 7 Sep 2022 18:06:22 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e8QgLPvp0wNAMtV1skX71KhdPzAj53gJVTA2icfMEirRdNnkI452bNH/tqLtB+CJQYEeBae4EHNB4a3niFsmZ2Qen5BP7zw002Kekks7uhzuq0D86IymfBZbtj+xIjq/ZHp4cMDrwqMdmHmMUbQRO9/2hUeVcApFL2FbshKpWhx68n3b68oIl2Z/8bc51vms2D8elHuQ6GArROqH/SST4ir1NaAuv23/i4IYHnie7OvtF+MmOV7k7JevLNOLSpTb4dKRgErJUcogohe/NbKR9teYaMIJtA/44G6ubX6w7NZ4wDXidvShGHAt+K0jOxnDi6z4xZEbvx057boF90W+BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=X8PtyTLvMa6nVWnG0vvquB/9r6+t5Wg+jXk3XAfQCtY=; b=HKShWLhsN2Rt9I0DcLNAoCYGwIp5f7jRYd3TrJMg+9g/YB67ATlUgdfUOyEdFRbwcs0EYa51PRLqNZbvFlMVUq9xPIuC3ODIPIw57CBpPJbuRw85YOOyCiAFFEZj/KY2CpOjgoCL91a9HE4hnTF7kFHUC/DSaliweR/CHKCWSF6etrFqSSNApXc+3PRi93kpGL8HFYAv42p9P7qTOEbyEguo87mfJlgF2BWKpMy0TMSgzUz48jH9IPxHBMGN1W3iEGK+0zv3BuKZfOEfnhBzKy9qv6jXeQUkOj85mNOo25TsOtGhAoAPbI0pWj30tuvjTatle4a6BjiWI8ZFxbPl/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=X8PtyTLvMa6nVWnG0vvquB/9r6+t5Wg+jXk3XAfQCtY=; b=rc+nbyeyy3NtDyxCsgE1lzOgUjzg1vKnfbyd5u9wUiaQCfMPTv1KWSRtuqiTB8DYLw8l5WZkfq4Lze537g20FELTNz3miBrVU3rWgHrpcy4pTS7vSAmIznxOGb7hhNA8FvsYNNXd0Y3drIGsQ618i7ACcBXH6+2XCORZqfL1Rmq8iVePsyFpenZt0he4lWJBMPUp/YqH9CgToIU5WO4zCjudX3t5/8WpWbyUnyx3AHI1T32lo/tlsgb6iUowObQ5H2ZrVzU1mmI3KB+dhgKjLu/D2ewQArF/2OmklShbuFtFjMfIlmGGspbIkZjl7IvRNFM7tgaEUqdgwqE/RCBTIw== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AS2P250MB0990.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:59a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.14; Wed, 7 Sep 2022 15:06:20 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::c3af:c609:301f:beab]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::c3af:c609:301f:beab%9]) with mapi id 15.20.5588.018; Wed, 7 Sep 2022 15:06:20 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 7 Sep 2022 17:06:14 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 X-TMN: [TRxyFJnn4sgmxz0xZCXYTqqrMtpbnee79T649f1slCQ=] X-ClientProxiedBy: ZR2P278CA0011.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:50::16) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20220907150615.1883270-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9b58ca33-8a0d-4ea1-a883-08da90e285a9 X-MS-Exchange-SLBlob-MailProps: feAVlmA1hHWbkhKm98zMtUqB+9m+adBbeB1fi5e7m6mi6eXUgsO1gAY8dG3C7UIW9WWP3TFS/IX9DPBoRzFz7qUoiata4ifkSU4tuxnLN6DwPT2TEMvJrlxRtKuXfs4e32h29Rq+iYzZySYwoymCtbOJIzBJl3oTeEz+97GoaHDNLEljBHPXpXVw3TFDKKU78V3qa37OR1F0z9Be80Ggm3JE2Tb2Le2Aky/tcIhVoz4d5Kxf+JuBGlrDBdo1C9tzMqpZ+haSxvcc7BsvXPzp5gODQv3YhmfnVH5KEVs5aBPy3gKE3+wR/lv6hDp5FEwLK5BOFp9ej18d7yZqJ/UvfZShgsZoS67A8hNejehNbu3WyRfAiLq+c6kgtsqszcxeuAmBrfpWjdIzbusV0yRL6Tibwa+w4qCzq07+wmAGPbViuK4v6MDcBUbQjYSD3D+kEWiwVdhIUA0VxZGQmaug8kPTWWiCJIAgHl10QUmquSQkBHCPO7sF2M8wnxN4WZVrrLJ4SztekzEy8wbCMBH5IAoSA4fKfDhTUp26BfyyQNOipVoS1gKOA15ErN3qf/OcWOF2CPujBHPEiJKMiogazz7+intNtjIC9du6XJGUvdZEyXXo4ESbrSjs5aptmxuuLOkazw7o39EGVxv6G4y6pYJj7ChJPyR7stmzAHHRdPjxD6HdJDoIKEnKxIq6SRN1FbRBg+0zeLDPW179jvSQxA== X-MS-TrafficTypeDiagnostic: AS2P250MB0990:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LRZTDuTOEpUVgMjl+U8YoZS1p4MQoXyZZdbMnAPSCKgwbku0dPtM15lokgI69NAO4TWgattjNIOrW9ffxuUnqZzXSW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ud+X+m1vjuYr72TsqbacRNviQU4GDXYmBijDPTsYaDqNVIEdPdGretvosaVsKvFVA6MGks1+tkPOoNn5wGw1fd94CdTUTnwBJpeqmNtHNLNKlejDguYaoYfoE4jyxJR91qqVdi1TjCRDAvu07VH1Cxh7n5Cyk4Jtjnx1g7qbb51GkxuU40Pd87nCc1OvDNdJjgQQOBz3GNqGfFbVEqY0IBzuuLhdo1cBskJtTFjqBlY1NH0GNRXGtjYUI62swwJP+nqifjSHuiaBf/iloxxNLTN7sVCSYzwouaeLMB8PVfR2Xjgzr6yJaMtSWm9WLNRwOFNX2cQQOjVNbjOGiAiMdbBHkAA4aFtPol27USPvW2IeVNn/13Bn/6Nwocb/x/vp8sAABO8lDTBcGmf7HLDtJa1L+pl4axTgvGT6trcv9J3M7fgExCwX5MuDDD/uXR23GeJ00z6ebTtbxX/mERlv0bL2mNf7+An9nySVwNjBdUc1BZoJkfWTfdA9CnzABP/vJrRJrAqKnW2jvRL5xg8/bXQDAwy9awdyquQMSflAE/NXa1nlcRmnoDIqXr+7Fo31yRbONNShJ47vO/7/KCgP7txDfX+ugBS2AysYukKvUVDrIevN55umNKLqDf66l4voUe5wFf1RyfhDHLFF4Np/yaXN+Ji6bR/myMm8KlYzmpvmCkX1GQK2jEzK5mJf70nfpQ2jlYvRUCfhdBzK+gHt1fCA4WReZHxyEQG+lliA+iy7n2+aQeOhUNaeqnLMJ/DB3jIf+c3hrJBtYyzAwGyppzo4N7PxDeDHni41mESW+o9p0GVwesD9LpeNPpLb3xSyAnM6dvcNs5dQOs2lozKpaZ7EU7rUUpTiiiuKzKFiv8+LMeCzPxNZsQRdq8 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9b58ca33-8a0d-4ea1-a883-08da90e285a9 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2022 15:06:20.8498 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2P250MB0990 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/ralf: Move frame allocation after error checks 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: fa88I19oUpW9 Signed-off-by: Andreas Rheinhardt --- libavcodec/ralf.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libavcodec/ralf.c b/libavcodec/ralf.c index 20c5f060d0..8f8e49f535 100644 --- a/libavcodec/ralf.c +++ b/libavcodec/ralf.c @@ -451,12 +451,6 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, src_size = avpkt->size; } - frame->nb_samples = ctx->max_frame_size; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) - return ret; - samples0 = (int16_t *)frame->data[0]; - samples1 = (int16_t *)frame->data[1]; - if (src_size < 5) { av_log(avctx, AV_LOG_ERROR, "too short packets are too short!\n"); return AVERROR_INVALIDDATA; @@ -481,6 +475,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, ctx->num_blocks++; } + frame->nb_samples = ctx->max_frame_size; + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) + return ret; + samples0 = (int16_t *)frame->data[0]; + samples1 = (int16_t *)frame->data[1]; block_pointer = src + table_bytes + 2; bytes_left = src_size - table_bytes - 2; ctx->sample_offset = 0;