From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 16E014F458 for ; Tue, 17 Jun 2025 01:17:39 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 2E97A68C89D; Tue, 17 Jun 2025 04:17:34 +0300 (EEST) Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 3CFE768C4C1 for ; Tue, 17 Jun 2025 04:17:27 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 36A0A1F433 for ; Tue, 17 Jun 2025 01:17:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1750123046; 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; bh=4hbwiPzeVaNlWcqrJCapMTc7HZl1xdaL1eX1O3zmzcM=; b=miumHcaQOPClG4wyGckpbShSsP0nDBpzTjUpxB8ErjkHtP7slzNEF+hzK6bS4zyy/YnErw CxP/T7QP7hqV6J5nALZZv1NS0K8oxEzGGcgf2ifKUlZy6gdwY82M0/H1YzWjQrT0pQ8vB5 zPTh0ouGmioGc8bEM6SSjIqFcU+6nLdmLZVz2OAJrAjUfxZxRQs4Eup6bpBxTnN5pnj1Eb fQPiHI1Dmqat4EGew0ASXrU8AJf57CMzBkFd/ieXCegKBOGMFiFnqh6JUNzNFjAUb4F8oT oTNqpdcrzGF02hX8l6qGX6quibAekPd3zIrVvQSAFg2K1o3AF0xeQpR6qAiHhw== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 17 Jun 2025 03:17:23 +0200 Message-ID: <20250617011725.4109593-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 X-GND-State: clean X-GND-Score: -85 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugddvkeduudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrhhlucfvnfffucdludehmdenucfjughrpefhvffufffkofgggfestdekredtredttdenucfhrhhomhepofhitghhrggvlhcupfhivgguvghrmhgrhigvrhcuoehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgeqnecuggftrfgrthhtvghrnhepjeffueefffevvedthfeuvedtfeejteehieetffehteegvdduudevtdfffeejhfelnecuffhomhgrihhnpehgihhthhhusgdrtghomhenucfkphepgedurdeiiedrieejrdduudefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepgedurdeiiedrieejrdduudefpdhhvghloheplhhotggrlhhhohhsthdpmhgrihhlfhhrohhmpehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgdpnhgspghrtghpthhtohepuddprhgtphhtthhopehffhhmphgvghdquggvvhgvlhesfhhfmhhpvghgrdhorhhg X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 1/3] avcodec/osq: Fix signed integer overflow in update_stats() 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 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: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself Fixes: 410109093/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OSQ_fuzzer-6550900028276736 Note, none of the available osq files uses update_stats(), this change may fix or break files using coding_mode == 2. The code prior looks wrong though Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/osq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/osq.c b/libavcodec/osq.c index 1e94a486e9e..14c723ed9c6 100644 --- a/libavcodec/osq.c +++ b/libavcodec/osq.c @@ -146,8 +146,8 @@ static void reset_stats(OSQChannel *cb) static void update_stats(OSQChannel *cb, int val) { - cb->sum += FFABS(val) - cb->history[cb->pos]; - cb->history[cb->pos] = FFABS(val); + cb->sum += FFABS((int64_t)val) - cb->history[cb->pos]; + cb->history[cb->pos] = FFABS((int64_t)val); cb->pos++; cb->count++; if (cb->pos >= FF_ARRAY_ELEMS(cb->history)) -- 2.49.0 _______________________________________________ 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".