From patchwork Fri Jan 13 00:01:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 39994 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bb05:b0:b6:a58c:cef with SMTP id fc5csp63033pzb; Thu, 12 Jan 2023 16:02:44 -0800 (PST) X-Google-Smtp-Source: AMrXdXsuRdK4dEltwgOC0tAVo8hgxangCcErbN2LXyus3r0D85+fuBh4za81aYtMNcnhOI2d5Lkc X-Received: by 2002:a17:907:674e:b0:78d:f455:b5d4 with SMTP id qm14-20020a170907674e00b0078df455b5d4mr5255872ejc.20.1673568164367; Thu, 12 Jan 2023 16:02:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673568164; cv=none; d=google.com; s=arc-20160816; b=cCEWNuKeXv1Ak+zxHN8ij2r7X28mTI+gS48eGY0SNrR8MXWdsyiQQFh9x2jVeY6wMU SqmJh7ocblMleuYOnnnN2f0qlzvd8VIEFSGPnzO00O3FIwrABcyHWFQz5bl0VZkFA7rK m4HC+vrdiUTRe6m9fK7faX12JqOPsAH3x+rg1RvAes8uV4kLimyYUIbNRHFa8SS3JXZC zLtxKgtY/FE/pDPbbrdwHvKpQHsD/4vEhxg/ci21BX31XALdZyllIF23OcdtIvmZ4giY P+xuorwoRu+dFnrJQkANF2xUQFpA17GTNfzTquospvUkCq4jOLg/CHnTmVEOXmXml/p9 lIPQ== 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=+sndmA8bL2FsV6jLJDW/Hy0N2DFNgHovFz+6UmAsUPY=; b=EMzADMAwEJHug+E3FvxBrTny66CICiPeZEGhngk50W7ef3NTcB0nG5gV2MRxVqOik4 ybJEzDlrXLi3TPfgLwIqF5Z2fvXKdkm9NWkF9vruWHx1PO+13theydXgCq0JEb49joDC Y0stOB1MULgiwyr1T0nmaJ84VbcyqfF9uxQmR3yKBP3DUNeGIyXtu695jIjxZrZsBq6f RxPza/x5TMq9sMIPbD5zp1YYAFj8DP76vjj5gGVOJwUUEkiNH+64CzkE3+x3gNiiA+N2 X7JWnJA4dl5DTZX7+8oR2x8elQC/qR/5hU1ti8T8i6wuOdXtidmFYKimNnUUgWQefTB3 RHfg== 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 xj1-20020a170906db0100b007add5af39f6si16899046ejb.929.2023.01.12.16.02.36; Thu, 12 Jan 2023 16:02:44 -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 A48B868BCC0; Fri, 13 Jan 2023 02:01:51 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 461F868BC94 for ; Fri, 13 Jan 2023 02:01:44 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 612E71C0004 for ; Fri, 13 Jan 2023 00:01:43 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 13 Jan 2023 01:01:38 +0100 Message-Id: <20230113000138.9994-5-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230113000138.9994-1-michael@niedermayer.cc> References: <20230113000138.9994-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 5/5] avcodec/sonic: avoid integer overflow on quantization parameter 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: n/Ivnln5sijH Fixes: signed integer overflow: -1094995529 * 16 cannot be represented in type 'int' Fixes: 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SONIC_fuzzer-6681622236233728 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 77bdb418a7..95ac2b1a96 100644 --- a/libavcodec/sonic.c +++ b/libavcodec/sonic.c @@ -1013,7 +1013,7 @@ static int sonic_decode_frame(AVCodecContext *avctx, AVFrame *frame, if (s->lossless) quant = 1; else - quant = get_symbol(&c, state, 0) * SAMPLE_FACTOR; + quant = get_symbol(&c, state, 0) * (unsigned)SAMPLE_FACTOR; // av_log(NULL, AV_LOG_INFO, "quant: %d\n", quant);