From patchwork Tue Feb 8 14:53:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 34181 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2c4e:0:0:0:0 with SMTP id x14csp877797iov; Tue, 8 Feb 2022 07:01:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJw2gKr5g3GmeqjRUDnXQ6t8Kci/1Yomr7LNWMIXHhdEno6x5CM3RGA5TuZDs8N/ctpUSqS2 X-Received: by 2002:a17:907:7ba9:: with SMTP id ne41mr4308305ejc.554.1644332492805; Tue, 08 Feb 2022 07:01:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644332492; cv=none; d=google.com; s=arc-20160816; b=e9a/MpDxCCKgAlZfZahe0b8w1n82jKScqzXhfucPaZ/u3nXGV75Igd/f8LZzKXC7e8 kwx7zhzAM2h7mbxpxNlzkG23kehGbHDDBb4SrL/tQpK4u/aZHPxrWYCLC7e5vDuRGpdi rVhmdID2OaJpxMxH2TaR37C18Lb4+wSkRtzdxAUu2W14Vy3mlJaLeDoi/qwUMWWcEQs/ 3A2HeZkhAQCWfkeDKRFxanNqGAnbAZn9jRpde4NY5hrU45sQLQpiVPz+zV3Wef/wDDe5 gkFUN8tig1hLCPVw4hmb9ZXkYcEc+UMfnfryViOslAZhjGnxlTcp5hK0TeYsfq1QlsQH PTTQ== 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=dnCrr9RAh6sIp7ymccvdngWaM573HEE9spLwSflE/CA=; b=zns05A9Peuc/pvtnmvEVi4AI5l+mSpPyHw55IKwgr4YX7I/aK13OtSMmjxK4pLmUnk 5Xh6tPM6crzye6AI7RawoxQZLwQdJ26pwuRrDvnYNZi4rsmzooSiKeesc5BUF6yLa26N /uVVU8a+VRoUWd9OwLt71md+gWAFZNP/4p0SS12Qb700zJRKBduKMQ8YLMF83jMlJ64N 7rYVHJLz2x+XYyLdOLA2vd5KUeHVgZjVbFaZphpU2TGV8OAbmOhrQCG2JOkZlrLcVyGB UxCh/eoODIZDlB8gaPlDLGrxqbS6fdaTIxGh30zK18oRSGs3SlJdgr+qO7+cejM46Y2C 2FRA== 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 v19si10320272edc.188.2022.02.08.07.01.31; Tue, 08 Feb 2022 07:01:32 -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; 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 5B3F968AF96; Tue, 8 Feb 2022 17:01:29 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe03-1.mx.upcmail.net (vie01a-dmta-pe03-1.mx.upcmail.net [62.179.121.160]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5A76D68AFA4 for ; Tue, 8 Feb 2022 17:01:23 +0200 (EET) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe03.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1nHRso-00GezG-0J for ffmpeg-devel@ffmpeg.org; Tue, 08 Feb 2022 15:54:18 +0100 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id HRrqn1tD0SgGFHRrqnHYTW; Tue, 08 Feb 2022 15:53:18 +0100 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.68.29 X-CNFS-Analysis: v=2.3 cv=f8Q2+96M c=1 sm=1 tr=0 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=NEAV23lmAAAA:8 a=fwD9BNtiQAMDJSK6jCwA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 8 Feb 2022 15:53:18 +0100 Message-Id: <20220208145318.26969-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220208145318.26969-1-michael@niedermayer.cc> References: <20220208145318.26969-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfACWPegicSQoqXgT9+wO6/qw/Bz/GSed+ys2H7+j8KL3qESg8x1kYi4ZiP6FKgWv5G2wERo7tuEkROBRid7uOrbEcG5z1zt8keqW4lH+QTpebkXVlE2O R5EKviEl5pZBtqlAv0DYUxffETxtt8RYdc00CtCt59higTMajF3ehA/7 Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/sonic: Use unsigned for predictor_k to avoid undefined behavior 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: kNh07aBrQBFE Fixes: signed integer overflow: -1094995529 * 24 cannot be represented in type 'int' Fixes: 44436/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SONIC_fuzzer-4874459459223552 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/sonic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/sonic.c b/libavcodec/sonic.c index cf1cfb1460..0d539e8879 100644 --- a/libavcodec/sonic.c +++ b/libavcodec/sonic.c @@ -1004,7 +1004,7 @@ static int sonic_decode_frame(AVCodecContext *avctx, // dequantize for (i = 0; i < s->num_taps; i++) - s->predictor_k[i] *= s->tap_quant[i]; + s->predictor_k[i] *= (unsigned) s->tap_quant[i]; if (s->lossless) quant = 1;