From patchwork Thu Apr 4 05:02:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 47792 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:24a8:b0:1a3:b6bb:3029 with SMTP id m40csp100615pzd; Wed, 3 Apr 2024 22:03:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU6h+mHJC9/LfwjigcPrFvk1ZoEP23ZbaDNOSC4c4+WdVhCMVOie9d0x7QsFXzmciAhtGD/1zAcfISSw2sx+e21bANbroxTgP+aTg== X-Google-Smtp-Source: AGHT+IFLBWHfHMBFqkqaaLKW3iimu70EscgA/ZywGloaDEAL8QMz4OFKbwjdFjlltjKYEIhw5nXt X-Received: by 2002:a17:906:a290:b0:a47:134d:2fc8 with SMTP id i16-20020a170906a29000b00a47134d2fc8mr4010788ejz.10.1712207009758; Wed, 03 Apr 2024 22:03:29 -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 jj22-20020a170907985600b00a518fdbdcf1si14930ejc.521.2024.04.03.22.03.29; Wed, 03 Apr 2024 22:03:29 -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=fgOxzvCe; 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 330B468D16D; Thu, 4 Apr 2024 08:03:09 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2054.outbound.protection.outlook.com [40.92.90.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C0DC268C068 for ; Thu, 4 Apr 2024 08:03:05 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FdrJkmoQ+wp9cAH6/kl0eaMrMJXgxaHLGa3B/sSI/CBxSz0jEJIBMw0TwM0WOS072jpXWHP41cWBkYKb0QoshjvmftIVWUMk0S9VbDZ3V3tZBOSYL8GNuNtscZlk6HoprwGQG41Dq1RYUg9vHl6J9HfW4dp5TdvKr6vFw2oIkYaYErliGiRzseCuNEoRIAT28KZyDhZ+g3LHs0IopKdWoR+MY3u8/psN7bT4CKczlrjimF9utnThNevfFqtyVW3w3rh+a0xHsUqfMz0FAGL7vZ5sVVOXHc9yfBySU523xSqEzqP9tzF3hYPlTveGwu4Sibbgny8aDEy4wD4i689rPg== 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=F5Qju5+OzPAs8MLX6PQ7j7XYj5yLQjjVL+I/Z3IW9vc=; b=LOjMTnpj95bEU09y5410sUrRx7oVL5kQ6lCyIi4XsSjUIKoDo/hRph1VCywL8s/VDecZ5Oc9s2ceWWRehGQ2ulL234i35MG4FvzH0bMzASxEIn66VQGhi8oda3RAbTw/DSeFvR0djt/Mw2nz3qHNVPSz/HE0WtelgZG3bpBjVMiVom6cCVRZGc/AVfWx1jWB6PAIVFnLXCiU9g5wOTzfadA8/cq9Uk7Gxza/x3akjdoJ3L6R+S0eifGOdVHeMqmPh9GOgZAiruGG8AfEFlw9u4OxgaNP4S3RoKMkt8O2DiKtvArasKHKFUVt+vSkSQdx+lxFjQVjIDznRiZAzIVuAw== 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=F5Qju5+OzPAs8MLX6PQ7j7XYj5yLQjjVL+I/Z3IW9vc=; b=fgOxzvCeJTHPcqqj4Tk8ksivvEhTgHqLg3qf2bdAHv8cMcS7hV8i9LeelYWT0wq1D3cxlbgZLeXjojCwFCO/KTuaOz91HORCwG9buG52kcicPjAmfSylloARko7TeEJMfs0LR43NjnzKOHk5lN5dVHtC8f8HcHhRM/9r9FJtDw2DaxAUxocybcNWrKkHtEhMSEn9jkvtIynFdnZ/ZRfxNZvlEW1lHnV2X1hI+U9jS652mvddX2ZrK/jFPDeMOB1JMOK2i7zTDHaLbOoN6cBBLpyRidNxrO6y0xcPbSwD5Tc+DYs1leWGBu04cOpZhC8eB5PsYjX0fCV8oSMXVWEzsQ== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DU0P250MB0436.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:348::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Thu, 4 Apr 2024 05:03:01 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::4a3b:cf76:cddc:c68d]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::4a3b:cf76:cddc:c68d%4]) with mapi id 15.20.7409.042; Thu, 4 Apr 2024 05:03:01 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 4 Apr 2024 07:02:48 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [d18RfRST68lCAOrNbX1hJQFniXDE3czJ/hXYcgn+Zxk=] X-ClientProxiedBy: ZR2P278CA0028.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:46::8) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240404050250.3450360-3-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DU0P250MB0436:EE_ X-MS-Office365-Filtering-Correlation-Id: 4dea3817-b3a5-414c-aaf8-08dc546480b0 X-MS-Exchange-SLBlob-MailProps: quCBMN2EvO+/Tg02NQSOAqMNnTlnxFBGqTCoZdMLb9RDuH+Q/LQ+P6Nyb7fV9EvtaTTYefqybzndBBoXQvdDArX0ZAucVXjznamqTZhScutg69Q44RWVS2g5wICLpZX32hgG85XhUiH2+UJ9mqKaOc+R2bGzd0SaTkKXQfQ1nSg/1zogLII2fim7qqTLItWKSsYvlDf5QDfqr2upW5Qh3i9uVd3/yu2MjiXOeawCqbdcYQN25c1IYKG+RA3AwXtRzHvQqni2hNTy+XdJUk82Y1zYCXLNyk8zlJ59E0go4zz+NvQ8ObCOlAsGiboIC8XiPOWIRWq5JS+ZoHxvfK+UXZHYyrhSc1YzouyDWuyxkBDjlj/LQlWXyZeORrxMudbtqKCchdy7Ot/kALt57oYRNO1Zt9ziYrUmZFX7I9b6eudDXviUA+VmYixhqrQbzVp6FrWhNkhrFMJT1auBdp3riElfTNrH1PyME5LOXpaRxriQK186QQq5ukYOIjCkjtdYQu3NqKA+D9YfEUXXF629an9GOIwrUT8iEJZ2B4vfPU1EStSUSHyvshUF6YLaB04rCzEd0yzJ7SxsToDYyGkkzFfkLBAQGipi5CHpIr9vmNY3ilzbylJZwsRgBdUDYMFYX2peD6cAFITMlvz4GBLFkOt5p13//WBDcs1LqY4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8-08dc546480b0 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Apr 2024 05:03:01.4317 (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: DU0P250MB0436 Subject: [FFmpeg-devel] [PATCH 4/6] avcodec/huffyuv: Return proper error code 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: nf7UYDjXUnlm Also forward said error code in the encoder. Signed-off-by: Andreas Rheinhardt --- libavcodec/huffyuv.c | 3 ++- libavcodec/huffyuvenc.c | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c index 723ab6b92b..f22c5ebc59 100644 --- a/libavcodec/huffyuv.c +++ b/libavcodec/huffyuv.c @@ -31,6 +31,7 @@ #include #include +#include "libavutil/error.h" #include "libavutil/log.h" #include "libavutil/macros.h" @@ -48,7 +49,7 @@ int ff_huffyuv_generate_bits_table(uint32_t *dst, const uint8_t *len_table, int for (int i = FF_ARRAY_ELEMS(lens) - 1; i > 0; i--) { if ((lens[i] + codes[i]) & 1) { av_log(NULL, AV_LOG_ERROR, "Error generating huffman table\n"); - return -1; + return AVERROR_INVALIDDATA; } codes[i - 1] = (lens[i] + codes[i]) >> 1; } diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c index 4f709143a2..152f94cefb 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -232,9 +232,9 @@ static int store_huffman_tables(HYuvEncContext *s, uint8_t *buf) if ((ret = ff_huff_gen_len_table(s->len[i], s->stats[i], s->vlc_n, 0)) < 0) return ret; - if (ff_huffyuv_generate_bits_table(s->bits[i], s->len[i], s->vlc_n) < 0) { - return -1; - } + ret = ff_huffyuv_generate_bits_table(s->bits[i], s->len[i], s->vlc_n); + if (ret < 0) + return ret; size += store_table(s, s->len[i], buf + size); }