From patchwork Fri Dec 3 17:19:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 31918 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp955884iog; Fri, 3 Dec 2021 09:21:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJzO1Ez142HMLdfOG/KUfTJt/cwnzO3Vcog7WxpTzrp+Lh8TOq5ZKWdiN32BFPfwLo/P8Wwi X-Received: by 2002:a05:6402:1d56:: with SMTP id dz22mr28064219edb.291.1638552101595; Fri, 03 Dec 2021 09:21:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1638552101; cv=none; d=google.com; s=arc-20160816; b=OYcOULt2QEDOCT13MxZEQaptkJRIfT0lJTUuP93BAkckxR8dCUxfkfVd1UYjtSSraP L4MyFNbWIa9gagI0TuKx+mc/cpvXdhBbS+d9tOQIKx3w8Q/U0/5EywDB7Fh0jkPrkPp0 4D2XAlV9ZJ8JIu0YrxB/x7iueGT9AL1OwVdXt6+e3iCpWc4nfej/qdsb5A8phZhCKCFM I99JC86zWJ+BfXnWLUDUg1cw65LEfxejh255rfzsYkXSZyItN9MnP51sky7QQZwL2wEv nAy1OWdrSNe3lyH8xql/yxRx99er0pkeLM7ZiTd0rcz91NqTxXG1kQZW/Rg6pZn55P+d Ymgg== 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=8hj4L+9Q+yuqvW5a0AQAYp/xyKNDWx9OxalRmRMAs5A=; b=T7ujOmq0ygJuwnPiL9Kr1j4tRMEMKC3jYBpw0fDIIP9fR0BIAX5F57Hcmqv5tdSauM r5uypDDBhNADSqagbSB7dHWUFDSJgd7TFbwU15Luxyscx+FskVD6ccT+39eMtlj8ExaS 8tMgJdCCImYBZBnE9qc4pdctr8VBShKlftvMEyCCbJigrEE9ggQVtuhqo/N2zBCl+9Il Xl1OswWWdCThwZN2aIMhvnITtQmbZNQWqhgp0bnhJJI4OuSTFQTS3CKlnitiE1lz7zsW WtnpXs/5821dLhdN0kcDaiKi1iVpszthVowA2QlesvYvd8fy9yHAoAP7jcJIHF+Homsx pKkg== 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 cw22si4606666ejc.46.2021.12.03.09.21.39; Fri, 03 Dec 2021 09:21:41 -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 6FF5868AE64; Fri, 3 Dec 2021 19:21:08 +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 C704968AB71 for ; Fri, 3 Dec 2021 19:20:57 +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 1mtCEz-008HUR-0L for ffmpeg-devel@ffmpeg.org; Fri, 03 Dec 2021 18:20:57 +0100 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id tCE0m7BicSgGFtCE0mKbkn; Fri, 03 Dec 2021 18:19:57 +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=sixEfw3dgXfOZcHC9fEA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 3 Dec 2021 18:19:54 +0100 Message-Id: <20211203171956.12231-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211203171956.12231-1-michael@niedermayer.cc> References: <20211203171956.12231-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfLd6wMgCCOCghu0cFGwb4Qn3hHuNZoAWd8F2exKFbXdj4qKkTDwVOgeH9d8NWgvhv/rbMao0VkCpusG2LR8t78K1fjHK1yhJVd7IYGwj5VcpEp5YHt1A d+2ZbNPNMPAG1CySsK0LSI/kisjrRDus2hRfpRzitnLGItM8jAVy39XB Subject: [FFmpeg-devel] [PATCH 2/4] avcodec/apedec: Use 64bit in 4/3 calculation in do_apply_filter() 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: Xti92KoBQrVf Fixes: Integer overflow Fixes: 40973/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-6739312704618496 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/apedec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c index 9c723f29977..5c3261cf5cb 100644 --- a/libavcodec/apedec.c +++ b/libavcodec/apedec.c @@ -1337,7 +1337,7 @@ static void do_apply_filter(APEContext *ctx, int version, APEFilter *f, absres = FFABSU(res); if (absres) *f->adaptcoeffs = APESIGN(res) * - (8 << ((absres > f->avg * 3LL) + (absres > (f->avg + f->avg / 3)))); + (8 << ((absres > f->avg * 3LL) + (absres > ((int64_t)f->avg + f->avg / 3)))); /* equivalent to the following code if (absres <= f->avg * 4 / 3) *f->adaptcoeffs = APESIGN(res) * 8;