From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id E15134532E for ; Sun, 22 Jan 2023 00:02:42 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 56B1968BC7B; Sun, 22 Jan 2023 02:02:32 +0200 (EET) 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 D01CC68BA58 for ; Sun, 22 Jan 2023 02:02:25 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id E5CC620004 for ; Sun, 22 Jan 2023 00:02:24 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 22 Jan 2023 01:02:22 +0100 Message-Id: <20230122000222.18719-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230122000222.18719-1-michael@niedermayer.cc> References: <20230122000222.18719-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 2/2] avutil/tx_priv: Use unsigned in BF() to avoid signed overflows 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Fixes: signed integer overflow: 100183269 - -2132769113 cannot be represented in type 'int' Fixes: 55063/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5039294027005952 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavutil/tx_priv.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/libavutil/tx_priv.h b/libavutil/tx_priv.h index 72f336eea7..d5ff8e1421 100644 --- a/libavutil/tx_priv.h +++ b/libavutil/tx_priv.h @@ -102,6 +102,12 @@ typedef void TXComplex; #define FOLD(a, b) ((a) + (b)) +#define BF(x, y, a, b) \ + do { \ + x = (a) - (b); \ + y = (a) + (b); \ + } while (0) + #elif defined(TX_INT32) /* Properly rounds the result */ @@ -132,14 +138,14 @@ typedef void TXComplex; #define FOLD(x, y) ((int32_t)((x) + (unsigned)(y) + 32) >> 6) -#endif /* TX_INT32 */ - #define BF(x, y, a, b) \ do { \ - x = (a) - (b); \ - y = (a) + (b); \ + x = (a) - (unsigned)(b); \ + y = (a) + (unsigned)(b); \ } while (0) +#endif /* TX_INT32 */ + #define CMUL3(c, a, b) CMUL((c).re, (c).im, (a).re, (a).im, (b).re, (b).im) /* Codelet flags, used to pick codelets. Must be a superset of enum AVTXFlags, -- 2.17.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".