From patchwork Sun Jul 23 16:38:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 42923 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:be1d:b0:130:ccc6:6c4b with SMTP id ge29csp1452688pzb; Sun, 23 Jul 2023 09:39:09 -0700 (PDT) X-Google-Smtp-Source: APBJJlHnFyoUlShGlzPR7QGWwewct3sT5D3nFhmgd/w5RbCITqFe+q3Qdh7nDz+AYudFnHAuHvkR X-Received: by 2002:a17:907:7632:b0:98e:1a0c:12c0 with SMTP id jy18-20020a170907763200b0098e1a0c12c0mr7241255ejc.7.1690130348794; Sun, 23 Jul 2023 09:39:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690130348; cv=none; d=google.com; s=arc-20160816; b=LdtdCJZ1NlBhQGurifDUnBlI4iTT4FBTaUMdw5gJANobU7A0LzJ2dlNWYERo4PQ2rV fDSi/GWidRVvTDiWe1ODJXy7g1ael+rBEknzN/9ucq1oiKurqKx7KzDog9y/84qFlmy+ 9X5l+gMnGGlvFQoz7TTiNDUCph5WW4TA3r0QpXf3RPBuHylVpM9mS6iEhGERQmJ3TiOJ LNU8WF9hviAfO1kG8rmS3eQOVlujJ3WJgeo3FCzyIoCu3xp0H1kJx6dVrkTeK6ipP4Tk ly6QPT25go6b5da7bvh1q1nhil301IqxIH1uBUtvft3kkaUqwo/WQDUnG3gH0aTmxmmH vL+Q== 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:message-id:date:to:from:delivered-to; bh=Xwu0JDdzxITY+/+d3lJi4PACEMbiLnuu4PVuQ6Phxks=; fh=YYwLYmpaV0Fpw/rxmSKNRLS2XzDkAlGbHATiKOPtZrY=; b=fVJAPck7wALcUedzkgkr8Mk9pW/Bzv8bdnfMIxJvsBgxsS4ASMKqROqPUdaKxqUlJ3 suAGQjBGkkX3+3MqoUq1IHo3pq6TvzAMgLYSZ3ARNOXwofwT7h7CI+gfhYeZ0tI9dINN +KUrXbLV2VdtXBnfFL2Sftg0yY6Ii0UBeInVcOoyehyDXQmOIZXrojo/Mva1lCzMqFPO 8us5YpnqyDylmx0f2tpIzEba5NDhQ4s1ztloLUp6T0Vr9TWq8QeAQcfLyVSwSEkRMGyq nERsgSTaS7v6nYO5Np+htbOEC2BaX+fq2sYJpsqdx1bMPbwJrFPRL0n3DCYo0dlHJSFw pttQ== 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 l23-20020a170906a41700b00992e520a593si4850820ejz.1004.2023.07.23.09.38.54; Sun, 23 Jul 2023 09:39:08 -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 024B868C6CB; Sun, 23 Jul 2023 19:38:51 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D6B5568C187 for ; Sun, 23 Jul 2023 19:38:44 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id C52FE20009 for ; Sun, 23 Jul 2023 16:38:43 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 23 Jul 2023 18:38:42 +0200 Message-Id: <20230723163842.8494-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH] avutil/tx_template: Fix some integer overflows in DECL_FFT5 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: oo2koq+VKvG3 Fixes: signed integer overflow: -1364719223 + -1468954671 cannot be represented in type 'int' Fixes: 58303/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-6501115717091328 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavutil/tx_template.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libavutil/tx_template.c b/libavutil/tx_template.c index c4ec9502e0..3a7848bb6a 100644 --- a/libavutil/tx_template.c +++ b/libavutil/tx_template.c @@ -222,8 +222,8 @@ static av_always_inline void NAME(TXComplex *out, TXComplex *in, \ BF(t[3].im, t[2].re, in[2].re, in[3].re); \ BF(t[3].re, t[2].im, in[2].im, in[3].im); \ \ - out[D0*stride].re = dc.re + t[0].re + t[2].re; \ - out[D0*stride].im = dc.im + t[0].im + t[2].im; \ + out[D0*stride].re = dc.re + (TXUSample)t[0].re + t[2].re; \ + out[D0*stride].im = dc.im + (TXUSample)t[0].im + t[2].im; \ \ SMUL(t[4].re, t[0].re, tab[0], tab[2], t[2].re, t[0].re); \ SMUL(t[4].im, t[0].im, tab[0], tab[2], t[2].im, t[0].im); \ @@ -235,14 +235,14 @@ static av_always_inline void NAME(TXComplex *out, TXComplex *in, \ BF(z0[2].re, z0[1].re, t[4].re, t[5].re); \ BF(z0[2].im, z0[1].im, t[4].im, t[5].im); \ \ - out[D1*stride].re = dc.re + z0[3].re; \ - out[D1*stride].im = dc.im + z0[0].im; \ - out[D2*stride].re = dc.re + z0[2].re; \ - out[D2*stride].im = dc.im + z0[1].im; \ - out[D3*stride].re = dc.re + z0[1].re; \ - out[D3*stride].im = dc.im + z0[2].im; \ - out[D4*stride].re = dc.re + z0[0].re; \ - out[D4*stride].im = dc.im + z0[3].im; \ + out[D1*stride].re = dc.re + (TXUSample)z0[3].re; \ + out[D1*stride].im = dc.im + (TXUSample)z0[0].im; \ + out[D2*stride].re = dc.re + (TXUSample)z0[2].re; \ + out[D2*stride].im = dc.im + (TXUSample)z0[1].im; \ + out[D3*stride].re = dc.re + (TXUSample)z0[1].re; \ + out[D3*stride].im = dc.im + (TXUSample)z0[2].im; \ + out[D4*stride].re = dc.re + (TXUSample)z0[0].re; \ + out[D4*stride].im = dc.im + (TXUSample)z0[3].im; \ } DECL_FFT5(fft5, 0, 1, 2, 3, 4)