From patchwork Thu May 2 09:48:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48468 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c78e:b0:1af:7bf4:b644 with SMTP id hk14csp238157pzb; Thu, 2 May 2024 02:49:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX1Xvta7zWlRryIzFDxyoL8qt/TRwHd0wlFoqbIxaPj4PZFOh9fKn/L4nbO9B3zDyEk4KXmDOQ39U74YqX0pQ1fb1UYATc8QjI49Q== X-Google-Smtp-Source: AGHT+IEDJQ807kd0UevWfYF2qvlep3OiO2h4ZZGC+KnMmzHv9p3uHwLWPoQ/RAJI/M5J15Asj929 X-Received: by 2002:a2e:9c97:0:b0:2e0:298d:65ec with SMTP id x23-20020a2e9c97000000b002e0298d65ecmr3969341lji.17.1714643356276; Thu, 02 May 2024 02:49:16 -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 w18-20020a170906b19200b00a51ace5e988si333507ejy.875.2024.05.02.02.49.15; Thu, 02 May 2024 02:49:16 -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=aoXgeZUW; 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 2D73968D7B9; Thu, 2 May 2024 12:49:12 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04olkn2016.outbound.protection.outlook.com [40.92.73.16]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 902E268D778 for ; Thu, 2 May 2024 12:49:01 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WxFt7ZMnRicphN1KFsNigghlj1PgkzeoVRvsdvWBTcidD4cW2xBDQbbDanORyn+pVsGwT5PbavaLYYmDmx62Kvot5U9Lk3ligBp/No7rs0NcyVPjf2F/nJR0Pg10XyIuacw1r94+AH4XXiaAZAsO5gS+6JMqL0ydvsJor9S7XvNHYjo9+uFNVHf0NoomQNJJU09ePLilz6ziQCwuf5MLf3eXsGxNECmMK/2ZrFQmSXAEwYM6ZCWnD9JXT2TCbrPuUdSRtsPes2zW66kUYDhL7WJSQsSUzUKq7DCF+6B8laarIm5wmGEp5RAFKZjYgv1Vv5p8Yg7Tl7RWXkxAVZvoWg== 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=5cU7GQ13az9kI1HRtYJbOa9DDzMSDl0E99f7aLAISNg=; b=NKloe6sqy70nMlTJVPIOqMhUOhh5u+recPUKwoyL2sY1wFVZm8z/ecz+zBEwfHkCanEW58gvjLmRwtca15zMx5IoKvW0G9BOz+mazQnD9yP3UDKvtpCzNqLCXLa0/1IBH5AXE8Bo4ycIGB8FVPQpJBVtK3gEyTetvppgIz1PoP6nPAB5GKw17tkRThK1Q2j3ZKPWZfVtSBf5g0OrLDGfctjEyMMv+YFGGie+x7IiCGylCDTEIsXZvDRTHkDsN7hA8yWxIpMYGZ0lzOSkWxqN4oP34RFC1RuTmU4Wa2iBAccRzXicdpJpqi0V2TXri23mdnSCioceM76jlsti3UQ7FQ== 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=5cU7GQ13az9kI1HRtYJbOa9DDzMSDl0E99f7aLAISNg=; b=aoXgeZUWeNHe1YwBkbF6LD3VpZd6C5k+2OroOpLeKBncLz9IxDe7B/wnIMshy/dTMpxazntmy21kBSBXdycjTB7gvGec69lVoZVODM3xM0hqGSfhTAJ2hkxWesitoXOC3vRpmhtUrlbtjXuI6jzsWiQ8T7xiA177NUpq3Oh7juecFuWaREyDBnKLfyOs1uJzk+H9CLrm9FHgs42nZ2BSIful2X7B2l3unYS0N4qGdwIVIVhcK3sLyEZPHQGQUmVpwF4YIyetNkSCj1dHpTUt1LOM4XKhNbkGcM6qcUVf7Z0SM2D7yquG2tdq7a/x2tXD+SgVVuvYRHRfkP5CjcNQVA== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by AS1P250MB0432.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:4a7::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.39; Thu, 2 May 2024 09:48:58 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::1f29:8206:b8c3:45bb]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::1f29:8206:b8c3:45bb%3]) with mapi id 15.20.7519.031; Thu, 2 May 2024 09:48:58 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 2 May 2024 11:48:46 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 X-TMN: [8BMCXOVeAtACVQzIZ8vFjdRscbdxRl44Gv1UB13yOmM=] X-ClientProxiedBy: ZR0P278CA0040.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:1d::9) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240502094846.184301-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|AS1P250MB0432:EE_ X-MS-Office365-Filtering-Correlation-Id: ec6e953a-9fa9-4316-ec2f-08dc6a8d1695 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: XBRHaAO+3gcR4LOIfDc1LOgyW4PUSR2xId1f+pYSlZ46xj7cyJXPfVBUb4L8MWywtsEDzhsBIsmOx6O7FvkNUxhujqXDa192lMSJGAzE/c0jThVPmFPiQnkETf5y9HWHJHlFC5BIdS11baYX2XSSiVlSnROtYxyheSIulfMUI2tbiyXZBaig8MYlR3cFmhtrQm+QQh7fQcKCtJX7YTPff5i0KmtKioL9sytPxWfJn3JCOWsuzLr/bcYvwNo3tswn9i0EBXcrSx3X+aR+bfS0ci9o1AHilkRwByzMLsOyWwRkpyWgRCz7Nc/0XlZO/lpEeBMVIhgSmgJihu5Vdw3AuMg+LZnXScmNroHgCqWGLOvkTfAQyckZ1/oQedOsPKZBMTr68oYVdJEKpW3Chsv1NyX3/j7irWyUzPWN2jDdAzqWToKO39oLMgJVVU4IvYpKkpmcTB/+p94EaSw80uR/vJIPSKSoHpkfrYi/zH+rTAbLwP3iN9ZUWuwtbuKFhU6SB/2bGMeo+G2v/8THmiut1an6T9ST5svUMjB5pa0a4a7vcKTjDnB9X3tT55Ktd+e5dKH0vbadBMGyQ+k0C6W5Bg+vCwsykzLPMSQhzQBVSi7V+9rdXjvQo9zt60oiq8gB X-MS-Exchange-Anti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K+eqWRHPTo3DazXUUKZvk/w0gyOVbqOssyWImKvneGm+jMNBrP4DjSt29JGqIttIUC8NmIsXQzocUG2UBVkby23yRO/r4bSn9Xm/KSm2v07iH51h298IczWzJVlsE51GkLe/Tbc0uaGBr/hoIoD+6dCnU0zUS5KbdbviMyAWDXLlXC3BAqwrE3QvRDYjQ+f2xKZ4sN8Q9zXNvsGPIWKiX3BnwUuwdexapBoIOKtXfFAV11zWSYo5RQhi5Fk8FsbY2VD4Tg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ec6e953a-9fa9-4316-ec2f-08dc6a8d1695 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 May 2024 09:48:58.3830 (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: AS1P250MB0432 Subject: [FFmpeg-devel] [PATCH v2] avcodec/av1dec: Always set ret before goto end 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: zSzJDBWpqimN Before 0f8763fbea4e8816cd54c2a481d4c048fec58394, av1_frame_ref() and update_reference_list() could fail and therefore needed to be checked, which incidentally set ret. This is no longer happening, leading to a potential use of an uninitialized value which is also the subject of Coverity ticket #1596605. Fix this by always setting ret before goto end; do not return some random ancient value. Signed-off-by: Andreas Rheinhardt --- Here is a different approach that uses the translation from 0 to EAGAIN. libavcodec/av1dec.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index 79a30a114d..75cc3fba48 100644 --- a/libavcodec/av1dec.c +++ b/libavcodec/av1dec.c @@ -1333,12 +1333,15 @@ static int av1_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame) if (s->cur_frame.f) { ret = set_output_frame(avctx, frame); - if (ret < 0) + if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Set output frame error.\n"); + goto end; + } } s->raw_frame_header = NULL; i++; + ret = 0; goto end; } @@ -1439,17 +1442,20 @@ static int av1_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame) update_reference_list(avctx); - if (s->raw_frame_header->show_frame && s->cur_frame.f) { - ret = set_output_frame(avctx, frame); - if (ret < 0) { - av_log(avctx, AV_LOG_ERROR, "Set output frame error\n"); - goto end; - } - } - raw_tile_group = NULL; + raw_tile_group = NULL; s->raw_frame_header = NULL; + if (show_frame) { + // cur_frame.f needn't exist due to skip_frame. + if (s->cur_frame.f) { + ret = set_output_frame(avctx, frame); + if (ret < 0) { + av_log(avctx, AV_LOG_ERROR, "Set output frame error\n"); + goto end; + } + } i++; + ret = 0; goto end; } }