From patchwork Wed Apr 7 21:15:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 26802 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 D05EB4494D4 for ; Thu, 8 Apr 2021 00:15:25 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AEEE568A30C; Thu, 8 Apr 2021 00:15:25 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR06-AM7-obe.outbound.protection.outlook.com (mail-am7eur06olkn2105.outbound.protection.outlook.com [40.92.16.105]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E14D568A215 for ; Thu, 8 Apr 2021 00:15:18 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YZRI68eWfTGteweuCPs+B7k7a+V4SOqwCVsbVBwwUpkLg1PR5/9DgUxCof4NnYCCnSnWMLT2jNFF3+uaEmgswD5K/rb+oEEncEIUxKamCsqp31AexMIdqlPCdtpO8tWP0y425f6dfYUDCCUBjxD/wygwQZPpN5wzgUtPgTPV9sgiMgs7DsJrPtEMMwCbYNAnavWkkbCVW+pIalOfwD9uIZQ3xj9LGlv2zfoCN37ZGJ4B6QN0ZYxsE1vAP2uMY8BiF3OcMJhj+PdjWeyVoKkb39Vsn140Vd5A//uHZd7ozT1rQvJ97YVMP26dJU+cq8RYNHd94GCI+Ye+NnuBSSBn8A== 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-SenderADCheck; bh=nP9YGTsA0tuhZ9fG73CruQ0pV8+uZWTFIXG37T0bVQk=; b=KyNPH6kQTGANHQK/t+/Uzbu1mIUtx/9ydf1zHyF6Axu4jiWtN4RlSVU9G7PvZ94TNdMXDnOKSwBdxSqUfl/qCrBXlIG7tcBzlxqazK29MTbIRZVquRAdqLSPmNvGoEECL/qHwXqq6CRS/CD0vh5oUBiKPlsn0xls/yl6g+c2apM/fBaCS8q7XZso/Tvm62ehhEmebJB05oWUJJDDF6g9CWM9j7FM0cLZBChiesCZu3p4TlgYPg1guyYH133FJdfd4q9giHiL9GX2rB5CwJYvuhVcmCRGYxm2oxqQldRtr7wSbUmnLL2EcvWC2dbvs7oy8VKS2kUuAyk+jQQLXG9tXQ== 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=nP9YGTsA0tuhZ9fG73CruQ0pV8+uZWTFIXG37T0bVQk=; b=SmMWRQXeozIMYFu9/vff76YHsG+TTQsdUATpzt3rYQXck8U8KpvsBELK7SbtMk67fRFS3mImfMGtLg7ZMIHIH/jTfcqO0qT5sq5jlHpin04AWiBcP8i/dmaToDNnu4ybGVQpk+bUj7Hzey58w0N+6mVQVZ7UYpbSO34ninFvlUHverPEWJh9z0PePzmwIWmgsYwEI8++PysKNvn6qLSKohLPb6zGn+bA32u3g0uZ0p0ByLVVPzZgF+TRbyt/4h+Otz3eyjg8LBC1yq2fcklLsPEi5DrKzGc2Tko23oDt97z6sa+fhdAosIfkFgwGBqqumpADlnfUy6wz8CiC16gPxg== Received: from VI1EUR06FT024.eop-eur06.prod.protection.outlook.com (2a01:111:e400:fc37::4b) by VI1EUR06HT027.eop-eur06.prod.protection.outlook.com (2a01:111:e400:fc37::336) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.28; Wed, 7 Apr 2021 21:15:17 +0000 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com (2a01:111:e400:fc37::51) by VI1EUR06FT024.mail.protection.outlook.com (2a01:111:e400:fc37::491) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Wed, 7 Apr 2021 21:15:17 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:1BFF139E4E6D061A0AA893E8CE240044D2290BF1518ABB074B412611BFBDB250; UpperCasedChecksum:650A820EFC3D4952077CF969F16CB3903E65EC9D9E13E874F8F2525C2E35B36D; SizeAsReceived:7382; Count:46 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::8128:5de5:4e94:9a21]) by HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::8128:5de5:4e94:9a21%3]) with mapi id 15.20.3999.032; Wed, 7 Apr 2021 21:15:17 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 7 Apr 2021 23:15:09 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 X-TMN: [BcyLmQpgpe4JRaPVParz3PHCtndrZdml] X-ClientProxiedBy: AM4PR0302CA0023.eurprd03.prod.outlook.com (2603:10a6:205:2::36) To HE1PR0301MB2154.eurprd03.prod.outlook.com (2603:10a6:3:2a::22) X-Microsoft-Original-Message-ID: <20210407211509.323322-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.137.96) by AM4PR0302CA0023.eurprd03.prod.outlook.com (2603:10a6:205:2::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Wed, 7 Apr 2021 21:15:17 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 46 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: de1b0698-230f-47d4-519c-08d8fa0a3e3e X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNWfpqfqXw0xE2GLV1l9Ko8lr1xm71qlx2zWz5lGRxlu6+iO3zFrpO2c4fpfbG6JCGt0rweiSALG0TU4S8TOwyIDkrtomBXA8D0kQzIiES23QT7JB3J5siWtVxYDLaTPssAXrT4UHb72/8UKL1xGnrF/BxeuaW32WHG0hOtQK9oUZ+HldXiu8TwxQGHTZlvjMOcnTlMO+xLe4DMAc557CCY7Xs/OYW/jvG8gT1lWgTurnvlEkRyShzkdJh+NYDsJUw+J4lrfEmLeGBdrS2yICLSGgaJjkC6FxDJYcuAAsuwDONr3epXI2B1a4XTxscF9qs2t+otoofHLlpNqmDMyy9WBz6uXdfgNDubmSqYPFdb1qE7X8qCNChCC4bEY7iDBEvSBqjJWKD146wSXI+YChwQ6VShQ58ASv9zE3Sd6Z7wfVBnSXJjao/rzp1R+JR+lgzspivDgnpjvTIFlx9S+pM39k9HSjyd4z0nRSHX+XowVyzHCORIVDTGqwqwdHO2TGqHP5pijxM2/1ZarjZfE1R28OlkMNLCRODSaENwMtfbUxFoAPiM7PPYBwWeQr/E2jwMhww72NGHtrriWhceZn4axW19SMj2UpSMbNrgBLTa9zm6dWj0jZI+1oIx0ZXNX1h/O6fj17iC22Xfe7VQWgTk2uLRyRtImCOHwIzWGsGRtrvo7ZExJ/p6bGXPWcrjDTq7Eryc6tFoGGrk6DeYJC2/NNMGYZ9OPsUY= X-MS-TrafficTypeDiagnostic: VI1EUR06HT027: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vWSNrJPvBgIKW2951veKM6YWyBRhmFxdLadmkEgQFVqkGCWk8GPjNTajUIG+vVlRSCmWpO/4NVDoCO9bIbGO1tRiFXaEj6a8NjFHfcQZmZyjMSC8ZBErE6r47bQ9ZMnWTp+w7CasJWTcxxqCM/xkc6oCF4ZTYm5d9LovHmm5y3snCrzC6j0yzMZ25z0wCSIhtE4LWX3CvLU84yYHNyzgBJWsBov+JTOufSSCvsaXRuzHIOJ1fjChJKqoNmk69IngFVncN4nK9+ZTn16olWWb5fgo84iggatzfw9nEwfavSfuxMaI5w02mcq67K8cMu1Qrmn9FVG8z1nOYFXbyJWbS+63ONX4K7tryv+vFKvB1EmQK0DfqinI4FJoETz1HNTYtJwUwdx8XuqAkWpxF1LS9A== X-MS-Exchange-AntiSpam-MessageData: R+dALJl2+UF8yKYEnyPwcZH44+xNytW7z6fDj89pYQ1OFnUMtIWx03AtRB8pUM4msoH33Z/A/RAC3KaCtYEkCGLNYstEd09lnPDCB8PKq+Ts6iXzC54mUCnS6vut+Qvuwy3sNPXRTA54ptCMMoYyaw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: de1b0698-230f-47d4-519c-08d8fa0a3e3e X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Apr 2021 21:15:17.5862 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: VI1EUR06FT024.eop-eur06.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1EUR06HT027 Subject: [FFmpeg-devel] [PATCH] avcodec/proresenc_kostya: Remove harmful check 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" The ProRes encoder allocates huge worst-case buffers just to be safe; and for huge resolutions (8k in this case) these can be so big that the number of bits does no longer fit into a (signed 32-bit) int; this means that one must no longer use the parts of the PutBits API that deal with bit counters. Yet proresenc_kostya did it, namely for a check about whether we are already beyond the end. Yet this check is unnecessary nowadays, because the PutBits API comes with automatic checks (with a log message and a av_assert2() in put_bits() and an av_assert0() in flush_put_bits()), so this is unnecessary. So simply remove the check. Fixes ticket #9173. Signed-off-by: Andreas Rheinhardt --- I actually pondered removing said check when I wrote f9d1528fc900dac4975ce785dd95004daeacec39 (which stopped using intermediate bitcounts). libavcodec/proresenc_kostya.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c index d8edd12f34..54fc6707a1 100644 --- a/libavcodec/proresenc_kostya.c +++ b/libavcodec/proresenc_kostya.c @@ -619,11 +619,6 @@ static int encode_slice(AVCodecContext *avctx, const AVFrame *pic, flush_put_bits(pb); sizes[i] = put_bytes_output(pb) - total_size; total_size = put_bytes_output(pb); - if (put_bits_left(pb) < 0) { - av_log(avctx, AV_LOG_ERROR, - "Underestimated required buffer size.\n"); - return AVERROR_BUG; - } } return total_size; }