From patchwork Fri Sep 15 13:11:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 43746 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bca2:b0:149:dfde:5c0a with SMTP id fx34csp305583pzb; Fri, 15 Sep 2023 06:12:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEV+J1os1m142MOfbCISnJghBpOHFQ6+UIEDv48SGfseyALbcB6ViN4ZRSde6AejRaLtBzK X-Received: by 2002:a17:907:1de9:b0:9ad:e0c9:8566 with SMTP id og41-20020a1709071de900b009ade0c98566mr392251ejc.76.1694783556485; Fri, 15 Sep 2023 06:12:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694783556; cv=none; d=google.com; s=arc-20160816; b=lcnuzPETyt56Gfu33mP2I5ofOPtUVOBTpLERYO7JQOIFSA1h4KzzckFDNNVqZtfCyB olCOHFIQs4C0aHcRuoYj4iGg2hHiGoqNiLUKP6RO9PpT1R+vI58F1R1BRZv5qh/Yn/EP XvXM6hCa/iMqR0hpt5NhytsK4zc9JZ6X4r8INTAysm95W9XHMZ4plRkm3Dh5x5jw3nGp 8WOC93gyO+Nr2IfmsJsGYMF5lQcadPVSMaJRdNon42Rkf9ZpPcnQZTKuNNE0vL2PKM/e XhtTdD2q+XFvmSr8ULEbs7Rsozj7wHUZg7fCFcTgh157XsgFKdiXiYkaZWOTZMdOl+Gn Uz6A== 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=mseYpqojD1aLcGpPBJrzpqd6uZLQzbYKrBIdZx5AxVU=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=yJOrL+AJHAgIVPVi76oa7ZMOnv2pXCeFQRnIOORyp0M7+sVVJkJ6ix7MCT1eQ1Tweb zGlL0HqOAMg2nO1iM3fpzodMkrYZP08Zw5pAgU9NZwCr89+ZFGPjM90Bnftr03QuqF5M eFnJUqzHBGTSgFyfLV1CDU63oNUabsbM+cQkJ51QYhD/6KUOLyTEpClvEz7tz7fuYyCn 2I8CUqJH54k/SaZQGG0YfN2IhPacZL7YuxhPi6ceMyxJPCMqKZBBfOsWAADH45U4G/fA MJVyzW5UrYpzdEM0lDZnLGlmhvUTyvPQDVnzT2TDLQhXFRRokkL9jVJOeJfhDeIQZ4ak hJag== 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 js4-20020a17090797c400b009adc768b7e5si2424772ejc.939.2023.09.15.06.12.25; Fri, 15 Sep 2023 06:12:36 -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 9761268C77C; Fri, 15 Sep 2023 16:12:00 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3DD3368C7B8 for ; Fri, 15 Sep 2023 16:11:51 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 5C7AD240002 for ; Fri, 15 Sep 2023 13:11:49 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 15 Sep 2023 15:11:46 +0200 Message-Id: <20230915131147.5945-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230915131147.5945-1-michael@niedermayer.cc> References: <20230915131147.5945-1-michael@niedermayer.cc> X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 3/4] avutil/tx_template: Fix some signed 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: +PI8KqgAleJV Fixes: signed integer overflow: -1364715454 + -1468954671 cannot be represented in type 'int' Fixes: 62093/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5538774254485504 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 6e3b3dad338..8dc3d2519c1 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)