From patchwork Sun Aug 15 11:50:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maryam Ebrahimzadeh X-Patchwork-Id: 29534 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp1174800iov; Sun, 15 Aug 2021 05:06:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+jxm71DiTnKoUSqQ8/wiIeQ9txS3N+eypFFjpvDyjZjFj6aIqp5zKx141bRkhoi40SVJ2 X-Received: by 2002:aa7:c810:: with SMTP id a16mr13973924edt.195.1629029177625; Sun, 15 Aug 2021 05:06:17 -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 l4si8955949eja.81.2021.08.15.05.06.17; Sun, 15 Aug 2021 05:06:17 -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=f7DikJGl; 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 0E19168A473; Sun, 15 Aug 2021 15:06:15 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-oln040092075044.outbound.protection.outlook.com [40.92.75.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 43FD568A2DE for ; Sun, 15 Aug 2021 15:06:09 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lr38geY36R9qQSzD1LcEiNTNCUL1dVp0lTQavYs7zmrGcg1U0Z1HlWRL8ADf9krI7XDLjCQI+563nSKRbEomONRMbmikG7M22nKlyX9NLFvmjNG494kYBZJJBBFFqlhiVdUfFs8uJ2CktwHzw3vHsHMVnq48leSNJ7rzfdvNar8tXYO9GaGzGNfqiMZFuKd3iLBKNwSLqFBC66tNnryvBgYjjKzxpbUKEfCPwydfY9riqcQnKn/IoI2E9KORVlNZv5AG9w90sLTySb35h7R97APWlLiOp2xSYWp+zRmCBJ8AgW1TjWJJzer92HvKICdw1ltaL782pfkYtfug5yCkgg== 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=blji2dbHrXiLU0+ZzbmnMPNv0FtmH1ZwZqwY/9U061Y=; b=kMCnE6qLdJWUyU1njgZVYgXBBBQGcmxBr5YnOg4kvi6owjlL9niS+jqbpR2ARtEbTIZNpVMulRcqgpTQLkufkh3EdJytguIeArDc7zUJc8nc8+kvHlALTO2qP+80HHnb0GOnAtwVdcPsTLNGmgq+7c7WK+bm2A08Ej5kmI5Dao+GDWX2mE/k2efA4nGvFsOkg8AlzNgkGnpEjB2jQfYCABAFZjfOiP47TpBRyhOEVMlZ3MLqZSFkX0TB/1MPN5y63sNkagP4oF6856oGkmN/kKT+loFyfGMWhZuz8xdryrCFkXxQXXx+DTdGM7x8j1/VHQOZWxAlHumSE0Z3rlKZ7Q== 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=blji2dbHrXiLU0+ZzbmnMPNv0FtmH1ZwZqwY/9U061Y=; b=f7DikJGlgrTJl6u03BS+jQ2l02N0JmGf3xGbzC9OKKE0e92B5se/bS1GT8N5ikqqxZ8Q6Z0n8oIFVEEkmAVKYB6lGUmC2Cvi2U6kQwJTRz2qj6/o0wj3oZPsHxnvfopaa9vpSsSvHCYB4tNQ+P0wQe+o79Wb3HL9GPUtRFo8praERJNUu8zTc15IbSWVR93YLQ7MC72OZak4wP3Mbw5AOaLasIvmrJ5fmq6pivwLW2dIPaTDP0sR+iZ6Y4oBZDLDxgroSWbvtuMNYkdF16E6fD5Z/pbH6vgY8NRDic+v4Ddq/pCg0KWvSUBc41JxNrAZvBDGzRbDGyzkQJHs8zkL6A== Received: from HE1EUR04FT058.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0d::4c) by HE1EUR04HT092.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0d::346) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.16; Sun, 15 Aug 2021 11:50:54 +0000 Received: from PAXP193MB1262.EURP193.PROD.OUTLOOK.COM (2a01:111:e400:7e0d::4d) by HE1EUR04FT058.mail.protection.outlook.com (2a01:111:e400:7e0d::303) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.16 via Frontend Transport; Sun, 15 Aug 2021 11:50:54 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:740641FF6F3F47DF6BBB6665BB833FD304CF50DF2F3054113C15A0179E3C4755; UpperCasedChecksum:492C11C86D71289A410AEDEF033E19A273897CE3952023AD683D084DDE5639E9; SizeAsReceived:7285; Count:45 Received: from PAXP193MB1262.EURP193.PROD.OUTLOOK.COM ([fe80::b1f9:e0a6:6946:9c81]) by PAXP193MB1262.EURP193.PROD.OUTLOOK.COM ([fe80::b1f9:e0a6:6946:9c81%2]) with mapi id 15.20.4415.022; Sun, 15 Aug 2021 11:50:54 +0000 From: maryam ebrahimzadeh To: ffmpeg-devel@ffmpeg.org Date: Sun, 15 Aug 2021 07:50:42 -0400 Message-ID: X-Mailer: git-send-email 2.17.1 In-Reply-To: <24f0eae7-ddfa-4e07-3775-08d95fc5820c> References: <24f0eae7-ddfa-4e07-3775-08d95fc5820c> X-TMN: [cwiKmqrYZBmwE2h+g8mxIt9cNog/GoLz] X-ClientProxiedBy: PR3P191CA0013.EURP191.PROD.OUTLOOK.COM (2603:10a6:102:54::18) To PAXP193MB1262.EURP193.PROD.OUTLOOK.COM (2603:10a6:102:dc::5) X-Microsoft-Original-Message-ID: <20210815115042.1973-1-me22bee@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (5.239.115.203) by PR3P191CA0013.EURP191.PROD.OUTLOOK.COM (2603:10a6:102:54::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.19 via Frontend Transport; Sun, 15 Aug 2021 11:50:53 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 45 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 1ef5571e-cc72-4a0e-12c7-08d95fe2efc1 X-MS-TrafficTypeDiagnostic: HE1EUR04HT092: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: t7OiHR8sANvYJBPtmez1597AM0olW7ltP03AEqjg78ITn6602urrhAMOnlzGdoUkXydg00ertbh2DqjYN5lRymQUGTgMpdkgErLLi8/0TzcpZqdaV0FwE60W2ubj7f97yXeplP2KETgTZzEg1cq4GOdZOFhxBk3UA+AHCExdooaLBv79FS1paKXTf7E2JoQPFCxpB9ykCHqyqMZ+01AxV449xBZMPxZUWJd2c+a+Hr3Wep/UsfPf6jM6/p3ObRSt/GyIq55oWBENkFe/u1zWvzxo0P0GiTkYWwc+dkiXgZt3KYFagYG7KeNITsjani2F3J/Z7lgG3Li5H3nhDUtk5W5rMRObp3NGe1zS4dVm3q6hOaeC6eHOpAnGh9JLR8hAh3BIZIzMWepR04K7NVwjZxDo13PwLlYaqBoQV2rNoDKWm/ESwHRuqFcJTMEFa+Db X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SqeprPgfXVK8p9Y04FvJkUNQWpD95aGng0CGA+nUSucJYtWPIA8UKkIQyipUBebnRakwmCe/1Xj2WgdrnaaP3Cz8UytdfQKCIatoKEhguBTqj366nkiJJJxnkJ+MYO/PnnvPksbfephbwlLtuuNWYQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1ef5571e-cc72-4a0e-12c7-08d95fe2efc1 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Aug 2021 11:50:54.2487 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: HE1EUR04FT058.eop-eur04.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: HE1EUR04HT092 Subject: [FFmpeg-devel] [PATCH v3 1/1] return value check for init_get_bits in vc1dec.c 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: PcyJ1KlQSbU0 Return value check: return value check for init_get_bits in vc1dec.c As the second argument for init_get_bits(avctx and buf) can be crafted, a return value check for this function call is necessary so replace init_get_bits with init_get_bits8. --- libavcodec/vc1dec.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 1fb1950ade..0f7c07f2e8 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -444,7 +444,9 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) // the last byte of the extradata is a version number, 1 for the // samples we can decode - init_get_bits(&gb, avctx->extradata, avctx->extradata_size*8); + ret = init_get_bits8(&gb, avctx->extradata, avctx->extradata_size); + if (ret < 0) + return ret; if ((ret = ff_vc1_decode_sequence_header(avctx, v, &gb)) < 0) return ret; @@ -770,8 +772,11 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, buf_size2 = vc1_unescape_buffer(buf, buf_size, buf2); } init_get_bits(&s->gb, buf2, buf_size2*8); - } else - init_get_bits(&s->gb, buf, buf_size*8); + } else { + ret = init_get_bits8(&s->gb, buf, buf_size); + if (ret < 0) + return ret; + } if (v->res_sprite) { v->new_sprite = !get_bits1(&s->gb);