From patchwork Tue Apr 6 21:55: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: 26780 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 31F2044AF20 for ; Wed, 7 Apr 2021 00:55:50 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1A24A68A609; Wed, 7 Apr 2021 00:55:50 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-oln040092067036.outbound.protection.outlook.com [40.92.67.36]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 33DDB680378 for ; Wed, 7 Apr 2021 00:55:43 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hBU4CcNqJMaBhqGKATic1P4ikFYDN9uK2TaJRbtq3OjQX2TJPc8BpDNyQB0GXm4H0ZMca71VChxy1rwWsgc/JcvLFgkzM9onnpfO0xIYHHuKHbNFtZj0VAWfhdsXb+tiP9Knl/gUNYbjh50TgS3aYfvjTLOq5Ct3hwRwwV5hKMEw0wPAkw1qPmezD66zROYWJzK5lw0mjGGGxMUghh5NxKACllc/gZw7Vb6QJGY1Ip9DEpE4faLccjokCaYNaofAahgGRz6z20AE9Divqt2wyh9wLz3k3tIP1KkLg4YlJuRxk9NJYUtyQAGVRV+tH9ggAWWl7eM1/Dfg2L4EhWhjzg== 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=n8I3ERwbks7m3MDAXVV3Pd8TfiGMPyGACoAGSd1Kkqo=; b=Z7lpum7IbE4G5v88TQR5BEpbyUoou//dN8jfhdBa2ijGwsuqM7qHY1cfYeze1LjbcYezQW5y80SaQlCUEpKmRQ/Is10BeolCiMsAxdMAYOr1yv1mylERVDopv23uh6roTEuR+ahGQNhCrpbMP1xEsbNHOxUxll5r2ifZYSeS50V0uJnBOExEoItmtUVJkXfol3Uj1o014qHz0wiyKMCuMOfiNYgYCvgV73Y/+H/GCLm/9zdZ+9l2qjdQgn80ejNmb82fx1gpoYP9jFdBE9LY3WPQdIh/b8IITxCkMULRqb8ViGBorrOgeABLL+tEH8mjYHDoVukQLdft/YTOqLc5bA== 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=n8I3ERwbks7m3MDAXVV3Pd8TfiGMPyGACoAGSd1Kkqo=; b=NNA08T+GW94okTwSlCRZJ8qV3lhOGQVLFOgXp/n2iPwNKJ9azxj6DDQovaYXconNVBF9qPAFF7QZm1erpA6Mx26m8AZ1oGhn8zZMGpQ27e/DLVyS25GOHBQUGHsGFIMPmFA5CBGcWYkutHOTzn3Q37MKCAhoPh72glQ5pkt/94gVkPkDfQ/pOkYw+GlBCdYjejjnjFAiLaQytgmf9a1RA4RwaQLCcye/mqLJum0+k4/gDs/SQsyQ8BM6b6thdl/9IB5z/+tOGfQ3c2qOhpxtcUxod7c845J5T8qpuI6WLb3x3htvH/5bbQkr1rCvB8I8nPb+twDvAZr2gtNAJ1dspw== Received: from AM5EUR02FT037.eop-EUR02.prod.protection.outlook.com (2a01:111:e400:7e1c::4d) by AM5EUR02HT131.eop-EUR02.prod.protection.outlook.com (2a01:111:e400:7e1c::347) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.28; Tue, 6 Apr 2021 21:55:42 +0000 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com (2a01:111:e400:7e1c::46) by AM5EUR02FT037.mail.protection.outlook.com (2a01:111:e400:7e1c::182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.28 via Frontend Transport; Tue, 6 Apr 2021 21:55:42 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:4C9D92D233AF7CD76CD6C8138C4912A09DCDC55B82AC32EC0AA3C9356CDDB9BE; UpperCasedChecksum:8D67D7820D51B1116AFAB2878B2D857630639D6D09AABDDB4C90B99D5F210D1E; SizeAsReceived:7599; Count:48 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; Tue, 6 Apr 2021 21:55:42 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 6 Apr 2021 23:55:09 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [cffoWX4AK2KOOrmeG/MTQrsVrksIdVPA] X-ClientProxiedBy: ZR0P278CA0046.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:1d::15) To HE1PR0301MB2154.eurprd03.prod.outlook.com (2603:10a6:3:2a::22) X-Microsoft-Original-Message-ID: <20210406215516.832944-3-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.137.96) by ZR0P278CA0046.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:1d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.16 via Frontend Transport; Tue, 6 Apr 2021 21:55:41 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: eacd211e-2121-465b-c50b-08d8f946b906 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiRct5ooVDkA416xUUNF5iBFgAC8+VM8w0LQbRdIhW1Y1L+QaQoHolODwDoEndyNG+ofL9nMyQTsypWP0MrQ2jz/82ZVMikdOZqB+6WFV6TsURdo0IjRogwG+sjcnLVZqjbexL+scEhSt6BhhMyaWmlv91N5YMTjYwbL3LPI8MNJJ8c31b1urwC1QoCkgGksDSJ/jS9R/cqyp2qbJk7JRAYOb51lbzoVBjmSwlzVl/9YiGODQdnJ4htwdmmB6Q3dVNn0T0d9tHQ8N55Y5SspnaT5cm8GwetFf7kPFxpINistDMlejyNXnU2JtTC3OkadabCWJqLlIsW45HgmuazHcX4hz77KeHQra/6Ap2UFSOEthnnRvRf7T/9Idrqjp+Mca0gz6Hiugy7Ii8tRvgVzeXvoOEveRInLoV7qWWtEytSvzID1K3xOfoL/8vb6erizPpwgPd5q3K/bj+1DIPFhtXQKDERDxjtc6wj1PeaXv5B4q+T2UdyH3QcCfXgqE4BcMhcssxA8AJUHzg1JIEBMteo8W496/+bhYVRJrUVMH38ASuOUoSeFdXlba4aIjH4KHrFV/JsaTfnW/Cl+bEcMHl/07dMdC7YFFMcBB53cDiSfimwViscoMddX+TEdkJivKLZ0G/CdpKxkzbrk/jo3a2FRedyu92XTTpHvTU/JgXRbSnOEPISX2Y/R4z0sFDC89hp/ZhqMNCcQH0jPNZi1mpS/3mgwr3mAxYKiydqK7agQkZ/mPZuCGbzAencUkUEQgQU= X-MS-TrafficTypeDiagnostic: AM5EUR02HT131: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: J9KwlIKqdU84pWLTCvwpD/JBoUOZbn50VfDctO7E06xMjdrAS0tmWgtzUG97PVausyRpJYC5GHZeWZ/FeJUzPS1TM5ZITC3OdU5iL5aIjUHeV7i/NvCz1nOudBQaQlnUbYU7bIuPTS5q0AVTrXJALztoa5nZq8r7oMV3p70yAMQko49QPh4I8GN2km3C00Lu2ndk7Sn6aMalvjLxjlqlgSOh2KHWSUZD7/IkasAL9MBiuGyOA5jD3Yak1TdpxgFZGURww8cgTACLI6AtE6nmjBAp6fS7/pUqpvumYAW32PBlWr0BBQzQ2YocUpTBuVggcUFwyf4T4GINDdFFyqga8m4AxIsfZ/m91NuxAAt2+m14A71fxCAJezndXX9yusaFvlRteaQJ4OcV80uBrAvBVA== X-MS-Exchange-AntiSpam-MessageData: 1vuP0Rrb4QSwNhT9I1jB8Vhj52PgWIBWsmcGEAnmL8iOWcmYz6NtshaKevqAyTZiF2DHeyVgchcpflZ/v/3el9hhgp2/dO/3+5cpAih1b3V+f7dbpgslou04IzayMCvTb04HL8WZAe5+O1QqvdMxqA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: eacd211e-2121-465b-c50b-08d8f946b906 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2021 21:55:42.2249 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: AM5EUR02FT037.eop-EUR02.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: AM5EUR02HT131 Subject: [FFmpeg-devel] [PATCH 12/19] avcodec/mpegvideo_enc: Don't segfault on unorthodox mpeg_quant 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 (deprecated) field AVCodecContext.mpeg_quant has no range restriction; MpegEncContext.mpeg_quant is restricted to 0..1. If the former is set, the latter is overwritten with it without checking the range. This can trigger an av_assert2() with the MPEG-4 encoder when writing said field. Fix this by just setting MpegEncContext.mpeg_quant to 1 if AVCodecContext.mpeg_quant is set. Signed-off-by: Andreas Rheinhardt --- This can not be triggered if one only sets options via the dictionary in avcodec_open2(); one needs to set it directly in the AVCodecContext or use the private class of AVCodecContext. libavcodec/mpegvideo_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index d1f2460409..0a1d0db86d 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -564,7 +564,7 @@ FF_ENABLE_DEPRECATION_WARNINGS #if FF_API_PRIVATE_OPT FF_DISABLE_DEPRECATION_WARNINGS if (avctx->mpeg_quant) - s->mpeg_quant = avctx->mpeg_quant; + s->mpeg_quant = 1; FF_ENABLE_DEPRECATION_WARNINGS #endif