From patchwork Thu May 16 23:19:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 48941 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:3a48:b0:1af:fc2d:ff5a with SMTP id zu8csp2547097pzb; Thu, 16 May 2024 16:20:25 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVGG/mp7MQVAm3F1rEAfv83gqZ6XFEcpkRZn0gNcmldfm10VNEqNZoPMd+llKgb2qUDnIwVfxicP8ByLregH8jUqYd6AkbG9wiHbg== X-Google-Smtp-Source: AGHT+IGi1DWtn9HSpQ8yrfkZ4Mo6gScRvEKUpbZ3i1vgqWyIdTNzpjp1DHXq6Ata+oEU1t1r0A5R X-Received: by 2002:ac2:4e8d:0:b0:51f:c8f:630e with SMTP id 2adb3069b0e04-5220fc734e1mr12022991e87.35.1715901624077; Thu, 16 May 2024 16:20:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715901624; cv=none; d=google.com; s=arc-20160816; b=qgir94c7CJPSYpX3XhrgjB+7AyBv90ZdZphih9HTHPc8OzDsBNofhwGaSTO3aRdFFK dwCmRZHZlBC2SIVckUOtnzeiidW0ubonOoeD6kBv4r+3oEeBWXjTfOy7/IgdweqdRqB4 qs0stcyfDZ2m0AmU5UarIW8c5NDk9N1qRuPkOFJwo2x/lHwoX+plWZMtqvrurEPvAk8Z IczGYt8ocnngdbFvP4e0ftQqKNUP/3hWEvLQccq4A8gj3UQO53Gvrsu1Rzzytk/riPCU 78OMRAPy3MyU+wpFRjIIJ9BxSfaHM5orJDJBfklMtdA1AtuW3nK1D9y7C/0rs+dxptKJ buKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=h1jkNLJQju7j/aj17xLmgl5c+nA+wM6f7vd+ZA04pAg=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=gxZEhD064FhWhXaRUgj8RgSNMDpN6qQPrfA3dGvZMhEtq5J2QYvqx+pM1l4FXgaqkZ 2K7XwVqTTxzjeT8R2ySxs1kb0Mshn53kozZLeXZ70qLUvXC3ucZjqKCP+Cc4P3xqflqk Z8EwqMUqOXG2qDtEfzAZAhO5Nj/5vc/oFyxCMrNOnYxpNsRgAUc7c6exIyWogNK14bAO HTRCJQDo9e9KWHHuOpXnzyo3vOykVFGTvut43Eugu3LBQBz8MUw71mRhGhfPoPw8Fd2X CvyebDGZSRNPTGXYYpPxFoyVWB6jnaSIO5MPPbnvaDf7e1pa+A38KeKnNtSlCOPjOU8D OlTw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=n9PTpJcw; 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 a640c23a62f3a-a5a17ba3878si898726666b.560.2024.05.16.16.20.23; Thu, 16 May 2024 16:20:24 -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; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=n9PTpJcw; 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 8D67A68D32A; Fri, 17 May 2024 02:19:47 +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 6C81668D2EB for ; Fri, 17 May 2024 02:19:38 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 9DAEB20010 for ; Thu, 16 May 2024 23:19:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1715901577; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=etHksJlGMmKbuqxR6zFfI94KZqA6rGLkxaloBGO+a0w=; b=n9PTpJcwK20kJGx0Dpa3YX0SRwrZd8+ZLMXQKv5jVbmv+ZP8cLhNA1FqJjy2P5d9kRYDdy j05L/cwTxTBLu5s9cyNOkzns4oFQFKiLVV6toSPttg/ErWmbPZz9BB/SkQuSLU1V0AI/PV E7pAVAzTWAW+Zr1qkbaFrDhDX5I7VBfKq2suScuqn70MftuqhkOEl5CKYyTrJoyfEXSvik q8FKn8KxFArXjdDkjhuMT4B8fJUV/6iUjv2bzweX7jivk4OE3Mv2tpvbg5LhdRVGBWUktS 4G00T5bkb+wK3zdsmjJ9Fz/UQ9GxB5EIqEAtf7jc/+T3F4Rz3mgCMZi6sD+HYw== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 17 May 2024 01:19:32 +0200 Message-ID: <20240516231932.6950-5-michael@niedermayer.cc> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240516231932.6950-1-michael@niedermayer.cc> References: <20240516231932.6950-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 5/5] avcodec/tests/dct: Use 64bit in intermediate for error computation 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Yu1bAt1boitV Fixes: CID1500284 Unintentional integer overflow Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer --- libavcodec/tests/dct.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/tests/dct.c b/libavcodec/tests/dct.c index 010d0c1ac35..17a08144597 100644 --- a/libavcodec/tests/dct.c +++ b/libavcodec/tests/dct.c @@ -226,8 +226,8 @@ static int dct_error(const struct algo *dct, int test, int is_idct, int speed, c v = abs(err); if (v > err_inf) err_inf = v; - err2_matrix[i] += v * v; - err2 += v * v; + err2_matrix[i] += v * (int64_t)v; + err2 += v * (int64_t)v; sysErr[i] += block[i] - block1[i]; blockSumErr += v; if (abs(block[i]) > maxout)