From patchwork Thu Sep 15 15:58:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 37931 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp404434pzh; Thu, 15 Sep 2022 08:58:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5rpXQo6i4RYoXGHvtFRFD1fkRmDpB1UdfYVZ7Rt4b5AAkI+ZK3gZ51eb2Z4vT7bVYdHgx4 X-Received: by 2002:a17:906:770d:b0:73c:a08f:593c with SMTP id q13-20020a170906770d00b0073ca08f593cmr482484ejm.182.1663257520707; Thu, 15 Sep 2022 08:58:40 -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 h12-20020a05640250cc00b0044612f19c98si17118459edb.512.2022.09.15.08.58.27; Thu, 15 Sep 2022 08:58:40 -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=PN6OimBf; 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 B22B568BB3E; Thu, 15 Sep 2022 18:58:24 +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-oln040092074102.outbound.protection.outlook.com [40.92.74.102]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4FDB468BB6F for ; Thu, 15 Sep 2022 18:58:17 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kg9oY1k0nccyUfQ89xq+zKWXEiBLNJf+JE40thcauQWbagmTQM+SYOFXALksjsfu5bgpv+1lu57Wd7uMAFmyKUcFOkq64xKm85QgqfvouoFkTFyCvWwpJ0p+Py3Bb9k8Y4z6A6F2xwy0iHn14Ai8XaIHA3WEd9oCCoGCfKwNBGLwJgcZ8ezoG7miDKzRB8AwYWyDLwaYAFJyqRTJJSIdjFKR4LkkupjIvxFSKLDY77jlwSP8JdQXtyPRFTLtlyhJszEUTnaTKPpF7F2aTb5okrz9i0IzmiKrycG9wly19t7FjxSk9/DjY78ZNpxoNYe4jCV28aMDeqUJ8fnUJrZM8A== 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=BzX1JuQIygPPVruriXm7wjjaR/njm3GXTrHlFMwv/uc=; b=JnRTOWCCj7L3kUT3PW53rgWVr8DaLgtOm+VzvD6LyqPeYYqTUsOJzRRNPt36U58tdTh55iX4mJyOCbZaZIoMwjNRMKEXPEF3Tj1iWK5v5WqxD9seNC1M3i5uiacKziNG4v0SWGh9jLVxdoOi2LH9qv/4N1Yi4U4PhYnXGK8U9qft1k9N+s9o4IASdPF5FZkYxTKGBk70sEg0DGJyVlOjMZkmz1E2OU7UT/lOpujIuCTPgreIR3jJxEh7bwV5adcfGOlXt60HoNkrMHrsuhJkaQkZeTTntY1laiMkbD1jSzWz1SWJJN88baE+mwrIKM6oTXsbvWEPgO8/pbKXGZrbFw== 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=BzX1JuQIygPPVruriXm7wjjaR/njm3GXTrHlFMwv/uc=; b=PN6OimBfbv+5N5oVbi+xeODEnDC7CrODVVWaK9CwiuPTyojWi5yFPiPzPEyR0y7MopzF+8EsL77W8KJo+iudS5t3z8pEVrlpvF0HmiqpvxqkjHAIHG3g0V2EYT2lyrOVxK+qYdMAIDZOdNSwQl+H87pcqQ5qSrMjWDQCrB8oyJ42m0gnYHSKiNeRcp3VrbXLC8+CPM/3MPwxEYN0OC5FYEtc3mAVUn8HljoyHOUMSbnXVd6ahLaV5DW11kjPABBOSRzB1f0SfMyUKFQOPvE0E8UEYvPQ97K23kBKmaMTdOJtg0yCULVYkjJDxca9deHZBT4FBsioAy8n2v/RN+VpPQ== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by PR3P250MB0276.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.18; Thu, 15 Sep 2022 15:58:15 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::51a4:ed23:ea45:dfeb]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::51a4:ed23:ea45:dfeb%8]) with mapi id 15.20.5612.022; Thu, 15 Sep 2022 15:58:15 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 15 Sep 2022 17:58:11 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 X-TMN: [fi8v36MTaVkEMpmlj8w/PxVn5eFTgT0Ka48roKqTOhg=] X-ClientProxiedBy: ZR2P278CA0008.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:50::11) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20220915155811.1974594-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|PR3P250MB0276:EE_ X-MS-Office365-Filtering-Correlation-Id: 61f873c1-d4c8-4e51-36b1-08da97331930 X-MS-Exchange-SLBlob-MailProps: feAVlmA1hHXuRrZwjAG4DiKN2FtGTEkHCiozTp7FcsrBpCybS3i/ewwatpnL3OSoD34wum/NgErBjDBoCGfwNAr0cqwsmck23+FsCdiZDbxLCgwihqi5pgmDWX7CYggg2GJWbnH1FB1MkmTjyQefLqc1aj1ESxjCjPXdUHl0+VtXzgUSIbUcsnlrFqPVjXnqrGUhfg1cugbJNjH5r0L8xmEcTSwQ7SngLBSponkmehXLwacH7LslJYQorb2HMezpzl2YA+zH3lFtF148bNQLKNawfG6UaxiEvXyeli923uGiyy0rbzFomnqKF3ebJRbYf2HmoXRQOK4bXuPUKzTge+iplR/y/9B0KliRncIqhSQGplfNF4m93Hi2ZdlIaq/1QCdkCaKcZqS83LVTkaoTQqmA77RYDFUBNjEI58QQMT7XrRa18LdsEpIWNhP3gKkdXm87zyFzAJ1GbxSL/rr9iF+Yy+xbrGM9Zx3PnNLK9KZZq702hWC99Co/dXfY38uhqYugOkALs69i2Xh5SB3ugkqgZK0oXRRU7RDIyRUlwM4ox9qB4iv7wDooFg+2aeKWzTQinaXqdHnhhW5FlKQzwsBTJYaHoiFMS5VF299ddGAa5Dqo8Qro94pKxHVW1AVMU5Xpb16IVIAHGyakic4J31vvIjABJBG7NLC6joKB935G9MpZ987D+cM7HRi/MAbHRPUuXlmycD8eysWa1Kejkw== X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LLRUQIG2Q1NuxmIPYYF2nTdXA2Lf++HXvAZtizoJxF4/DIA7lXdrBAiM734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v3etR0sJ4xuFjkrgFlccF0e4kUwtKAnXUCAdnaER7TKYqNRoHeEfEwo9NUxjacb/m0erJhSQ/VzcQvDZoi8Sg2jz/ZzuapBasNAVmRJUnHGMMJV1fqv7xtLFPJuz+fOJCIOMad5FnGwVwE7wk6ZoNs8KgjH9W0IrjsyBJIQCicr0mqgWE3P9w31/4kqDWgNPr07aDvnPhjRjoq+7X/m8/e3FEuvoVJGPnK93ycMxtuihdOm9gvAIDuH1EpPBwhNup1Q+98xjxfKjksYeJvg2tPZz5KTN0mDC0XxunfUCRt6G7EM0Llv27QgeF8Tlk8PDuzbUr7wuqB056O4ZEKMfaK7739yQREQIzdYZwXQemSocKFHoBu9j7gT5OQbxQgIdtKeil4wQR5vXBjwiJCm9aphVbEMjcDDk7CSsEsxIr95ckFYPg5q70g7KNAYLuNjQxzv+nEXGxXxIt7U31TYyFZmv6+tKfhcjD0ZXY1V9ZRVtVsjLYRGk3YOHI3b4rARMrsW7C55XcbGVouD0TH1fVVVrOJP4oNI/E7Ir0Ifzek76rp50cs1sBMFj2s6E07TCwkV6CFzUQkCbXHZWIlHp+i3QsFxfHuDqrAmX1vxfLHqsJV+vQ59Bv7bDnb/q85aJEniydUrhShSVUWrx4bJhGJ12SspHEhhpTcHJV2gIhwEBUdSTUaCu3In6zog8oRQQbFinGBspyrZii2LcfMDc5VMVxKqMaZSARBZ4TuX4K3wpQQM/MQhQPP6C+gBAmlhKqexKP3E7fzZxQJvkPJAQEOXQL2+2yP+s51PO9/SeEJOjwCyNsZkZHNLLvB/CdeCMev1m9GAIixqeYOuJBjlCWnH5zwDTqb4AJbDSEh9oow5gOOBCiOCJQdNi+jguhE9vVW4c7yLBAR+WeVBg7C+9eYKoCKui56klQ1sf5 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 61f873c1-d4c8-4e51-36b1-08da97331930 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2022 15:58:15.1187 (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: PR3P250MB0276 Subject: [FFmpeg-devel] [PATCH] avcodec/adpcmenc: Round up required buffer size 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: +0SZs1GgovqJ Otherwise the buffer might be too small. Fixes assert violations when encoding mono audio with exactly one sample. Signed-off-by: Andreas Rheinhardt --- libavcodec/adpcmenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c index 1ffc5b410f..57709b19a1 100644 --- a/libavcodec/adpcmenc.c +++ b/libavcodec/adpcmenc.c @@ -614,7 +614,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, avctx->codec_id == AV_CODEC_ID_ADPCM_IMA_ALP || avctx->codec_id == AV_CODEC_ID_ADPCM_IMA_APM || avctx->codec_id == AV_CODEC_ID_ADPCM_IMA_WS) - pkt_size = (frame->nb_samples * channels) / 2; + pkt_size = (frame->nb_samples * channels + 1) / 2; else pkt_size = avctx->block_align; if ((ret = ff_get_encode_buffer(avctx, avpkt, pkt_size, 0)) < 0)