From patchwork Wed Mar 6 00:54:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46827 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:d90e:b0:19e:cdac:8cce with SMTP id jd14csp89745pzb; Tue, 5 Mar 2024 16:54:23 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU2yt5Hedh03NPka297EpWVkvzGoIrQCdQ+Vj5EmM/tpbW5XKyR9LdoSBcRVHQ/UD4zzXBgB1HHJ/xtEro4I7yclEaztecdlFbveA== X-Google-Smtp-Source: AGHT+IH2NgtSypE22KHp8pU6D6blceemyF7DMKqvzFK5X1qwpUqYOycIC2LTe7jVuAjadX0FnLpY X-Received: by 2002:a05:6512:1243:b0:513:23da:9766 with SMTP id fb3-20020a056512124300b0051323da9766mr2925853lfb.55.1709686463661; Tue, 05 Mar 2024 16:54:23 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id gb39-20020a170907962700b00a451594909asi3000406ejc.165.2024.03.05.16.54.23; Tue, 05 Mar 2024 16:54:23 -0800 (PST) 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=drQ7g8tM; 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 2DA8D68C9E1; Wed, 6 Mar 2024 02:54:20 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2048.outbound.protection.outlook.com [40.92.90.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4515068C77C for ; Wed, 6 Mar 2024 02:54:13 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BmIScvbo/ry8uHfWZ0ShqFu+NRrKtfKZtCky3sMFMsgfNt+y2CFmzU5Hnn283L4P691teCRNyszlUrdkbBaJ5M0NslWcRkS+flKNv0Xv30WjwA5L8Olz6Zg+o0F8lO1X0PPxjPFvcpsRvRq16/Jt15n8DzsIV232I2rF2lcFLc+VaYjirByPxC3240fV0xighv5x1JCMe1imbadVVTbFRHxjsXyA6ZL7eLiZl6YWEb5n1bc98Jme41dSEPs/U2U0ADTKy8zWxMq6pfHNw8OtrLX5rhRsC/8JV7IYw029Rz+/Fl7V9bZd1X6A97jzymRI5e27DrAsrZ/t4vgkc9c52g== 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=kgjDavZ6/lq8dRFw0z/VE9PGiOPHKAcZnF3YS07J7TE=; b=jktM/TW+tD4F0jhNa6WSFR+VWJya01gfnJ4DRRgnEh4J5csEy2TUhINUmUJRL788lFaeyHKNfJYKYejfF0bacAz9fsrjsQrWq/Yx8uacPPXgyhBxgu8wJwhzUO6nwhN5Di6op1tar5FEeG3lNSrAcvX4OXT5riB+qckqi7n/uyeNuYJwC18ViuDu3u7uW51ZLDgecsuG+iErzuhtJVs1Tw/PebGv5g/6hrGOr9dMQNSPrdQ179ERmutXG6dH5EDkpUam/x0SUPK4iT/XEDTd7NcmNr8Ca7APByctzpg0tyF4vSf/V9YwMM9cp6TYCs9qVexBL9FKoj/uDB87gRe75Q== 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=kgjDavZ6/lq8dRFw0z/VE9PGiOPHKAcZnF3YS07J7TE=; b=drQ7g8tM+Hd3IZ5rTa1SEUAIdcTvGruJK0NrAC5Zq5QaGakP77e652D75eoL6+ZfH7qplMfKhS97dpBqDjAjpfFfpwF8egCRZ9rxxNDZbXeXXkHDoOUe4wPYZGI2ClwESqrINz9rxZQUow7Hen0ZMTGJxN5kuyecPxZs2cHszI6o8kWNMcVTzHqFG7C4S7ahiEvp7GLH9vRfac4ufhI/9CCJ2yQpCs4Xf+ld+XjdPTJPja8sZVWf4X/927kHxdoJvo9necKjmYYuiAiZiKB500ILd4xjqqnKpPveAL5XKo/P6oVBNF3KPuMPcTBfoNT3JGlf4ajqzMvBBuKQZklMMg== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by DU2P250MB0028.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:23b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.39; Wed, 6 Mar 2024 00:54:11 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d%5]) with mapi id 15.20.7316.023; Wed, 6 Mar 2024 00:54:11 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 6 Mar 2024 01:54:04 +0100 Message-ID: X-Mailer: git-send-email 2.40.1 X-TMN: [ql3vC+fanjFcS1AyHZN6Yv13p1zcA5Sfrcb+1spVu5M=] X-ClientProxiedBy: ZR0P278CA0198.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:44::12) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240306005404.3123440-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|DU2P250MB0028:EE_ X-MS-Office365-Filtering-Correlation-Id: f19bcc63-e7f8-4a31-f56f-08dc3d77efea X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ysOQK+2+0LcVQOZk+FTTFnk0PGP9HjWvYRal/mp6qPUZKDvfRUsIWOjBC/zXfShmYcImD+TIx0cTtoYoQwHW87yjup4xLlUnM+MlckDbmYXzWCmPi0EdRhVSGmVwmeK8Fm3ZjsdAx7Qzg0i6bT6bNN4HhXqRpwcXy0OR6+YHlSuj3i59MouXOhsZrXpTvJFC1uABdZPouD6uJ99rtJAymf8/m7NdAgn3bc8VG+LQRy/2Tn9b99O3phZZs19ymL70jATZ7vbqfWkEFwaNCXnZCkeW0AwpifdAHUZevEjPsLg0oon2LuW/n3ooOgSLKa40ryG07sSXf98/EJm4OC+oSRwAfqygyUT03J3ExzXTxnRyMBJ10CN1E6Cs0cRua67nr/m4kMEM3zz4fXSnXLNXF2ib4T1eE6XHBWujly+44Ymi4c9E7WTshgLh1CfBmaNAe8WUGjFplsZt4wa6kq78OewJnDdGYg38/XO/wwLXIqA43X17Bgg8XV0FsEKqU4MlmRC0TAH6UYkQBYa5Hv8ogBqThjnxMFFyAvoARE9hURKJOHq5E+tjaND6n4PuEK0FypTA8g8/TXLMAUlnUTaBhlUFQbxcw0/N5LPn6tDIC0F+/7oNsBQSV/Ty+xtjWpfz X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-Anti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jg+R8QI92PX0ugDDwkPBTx1So/iKKfjAIV8KXIS7U/t8hLHSJU17Ivca+ZJVdRlxXHEbY4ROCFUTfj81mkafNlhDoKCEdkNyguijkXwKdiByZPO+Y2UsZYkLJiAZB1OZfMAFVajKc0vKHojtwumVBMoUKsZlXenX55OBrvXfUVUQsHDiPgJ6gwpZZU5zx8bUdzyhS0y7+SM4tOGExG6U0K1EWdpWvEyl4q2Y7xWoEA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f19bcc63-e7f8-4a31-f56f-08dc3d77efea X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2024 00:54:11.7170 (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: DU2P250MB0028 Subject: [FFmpeg-devel] [PATCH] avcodec/xpmdec: Avoid unnecessary size_t->int conversion 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: IhLdfn3UyGjQ Signed-off-by: Andreas Rheinhardt --- libavcodec/xpmdec.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c index 5bc02378c8..e7f8a90fdc 100644 --- a/libavcodec/xpmdec.c +++ b/libavcodec/xpmdec.c @@ -233,14 +233,12 @@ static size_t mod_strcspn(const char *string, const char *reject) return i; } -static uint32_t color_string_to_rgba(const char *p, int len) +static uint32_t color_string_to_rgba(const char *p, size_t len) { uint32_t ret = 0xFF000000; const ColorEntry *entry; char color_name[100]; - len = FFMIN(FFMAX(len, 0), sizeof(color_name) - 1); - if (*p == '#') { p++; len--; @@ -271,6 +269,7 @@ static uint32_t color_string_to_rgba(const char *p, int len) (hex_char_to_number(p[0]) << 28); } } else { + len = FFMIN(len, sizeof(color_name) - 1); strncpy(color_name, p, len); color_name[len] = '\0'; @@ -375,7 +374,7 @@ static int xpm_decode_frame(AVCodecContext *avctx, AVFrame *p, for (i = 0; i < ncolors; i++) { const uint8_t *index; - int len; + size_t len; ptr += mod_strcspn(ptr, "\"") + 1; if (end - ptr < cpp)