From patchwork Thu May 25 21:40:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 41829 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c51c:b0:10c:5e6f:955f with SMTP id gm28csp865304pzb; Thu, 25 May 2023 14:40:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7SPMJCZ6GioWC/uxjxNClOvKdq8hSOiZqZEVI2RUJIXVbVSP7szMu+Swwdp89hOiMUjLtj X-Received: by 2002:aa7:c619:0:b0:50b:7959:8b09 with SMTP id h25-20020aa7c619000000b0050b79598b09mr3748074edq.15.1685050856745; Thu, 25 May 2023 14:40:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685050856; cv=none; d=google.com; s=arc-20160816; b=XbV0Tw5fLhlnSTxGDbCeUXlTze/OoB0A5KEQdTAf9S7jo9MFIEArs6ScY0Twz1v2Ml +hw8GYgwqFg2MpRqMBc2+6IchjUkU7jWAnXDcMBjryL9NnIyYZTqk5PIkArRHFMoje7y GRJntXa0kjIM2N8vAXPwcc7yfi8muxZgSPEnjeiUAdMKvAUpMlfzmK89b0HpLRA2p9Fz FqGyHZyLPPG4l7qTtryOylIZtc9sZjZV4mJN0NfA9COZrilXFuUOEVLUiyDnXb5YFyTG 9p6z9LXn/7lyCFWnSEgb+BKkDMjP01TDu1pJNb8TNN7lf9zHeVLfeMvpazQRNMmiGh5T eF8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to; bh=izKZjzFd58eonYkWZFw80q9g0kIjRpsfoJb0F/eCJQk=; b=ngoy4w7Tg3t7bhNNNQ6Ip8rwbLCGcHunh8wjHA0dPrMxh44pMLEP0WrBO1HIDGuVoP KXKldQP1ieiXOVu07Lkyl+2GMuNZvQVKNu43pRTbz5GXn++FOaWVa2mYQMshqdSqQ5iz /quwK5aB1DR7gX6MWUhKvG0K/DyZ7x1Mh4aqG2Uf2QylndRVRMkb0SvE4RLpsVHtjGKP GpAmHDevTrwuEkleHFYqQYj58kcQULooQ7qQGv1mXpoOgPKmZbqW1cBhLsORqLMqejHR M5rPxPzBSp8+jtq91I7uPKEjd12LqsZTHworKOeYeTIHHvU9rKoCQot1EoSBojo5+nel fz0g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id o17-20020aa7c7d1000000b00510e76af77csi1428214eds.43.2023.05.25.14.40.54; Thu, 25 May 2023 14:40:56 -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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 838D068C1DE; Fri, 26 May 2023 00:40:30 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8488E68C1B7 for ; Fri, 26 May 2023 00:40:23 +0300 (EEST) X-GND-Sasl: michael@niedermayer.cc Received: by mail.gandi.net (Postfix) with ESMTPSA id B54A0FF805 for ; Thu, 25 May 2023 21:40:22 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 25 May 2023 23:40:17 +0200 Message-Id: <20230525214019.29048-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230525214019.29048-1-michael@niedermayer.cc> References: <20230525214019.29048-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 3/5] avcodec/rka: Avoid undefined left shift 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: /h5KyzGXQCmD Fixes: left shift of 34136248 by 6 places cannot be represented in type 'int' Fixes: 58429/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RKA_fuzzer-5692211592560640 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/rka.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/rka.c b/libavcodec/rka.c index 3e86d83819..01920dbba5 100644 --- a/libavcodec/rka.c +++ b/libavcodec/rka.c @@ -750,7 +750,7 @@ static int decode_filter(RKAContext *s, ChContext *ctx, ACoder *ac, int off, uns } if (ctx->cmode2 != 0) { int sum = 0; - for (int i = (m << 6) / split; i > 0; i = i >> 1) + for (int i = (signed)((unsigned)m << 6) / split; i > 0; i = i >> 1) sum++; sum = sum - (ctx->cmode2 + 7); ctx->cmode = FFMAX(sum, tab[ctx->cmode2]);