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 8B9634F44A for ; Tue, 17 Jun 2025 01:17:59 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 9736668C9CC; Tue, 17 Jun 2025 04:17:37 +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 2932068C88D for ; Tue, 17 Jun 2025 04:17:29 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 84A6F1FD33 for ; Tue, 17 Jun 2025 01:17:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1750123048; 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=tSrfuSwzxJleN3U0Xy8DpeKoOWer61DF7Vby8RnLS1U=; b=YlJw9hPuBWFUkIWuTIFqRib5X/s7mpU/02NQNirJmqGMWIyrv9te/fSxDihP/aHGil+6si X4Q+oMe1VwH2nICqvc6eJXDvZjzV+/et0EVV/Q1+HtN/o/y3ohyDw45jRmP0PxrME0rRqj yrncUzRgavtmG6of3MwdBzCugBqijQKAIjm4MoUhe89iIeet2fh6NL15fOJOSYLzY1cuVC 1cdQyuuxPZ3b0lKiu1zoYymGbF7XyMoW9OHMBiPM/TOqxpif2vdKhLDQcQhHU7ic1oCcOY x6BMsow/T/Y51YjASpo/FN2+XjZKFO2RvRKQgilRAsdPMvu7J1og0wY4775/oQ== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 17 Jun 2025 03:17:25 +0200 Message-ID: <20250617011725.4109593-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250617011725.4109593-1-michael@niedermayer.cc> References: <20250617011725.4109593-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-State: clean X-GND-Score: -85 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugddvkeduudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrhhlucfvnfffucdludehmdenucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofhitghhrggvlhcupfhivgguvghrmhgrhigvrhcuoehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgeqnecuggftrfgrthhtvghrnhepgeejhfetgefhgfeludegvdduvdffgeefvddtheetlefhueeitdevffevfeehhefgnecuffhomhgrihhnpehgihhthhhusgdrtghomhenucfkphepgedurdeiiedrieejrdduudefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepgedurdeiiedrieejrdduudefpdhhvghloheplhhotggrlhhhohhsthdpmhgrihhlfhhrohhmpehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgdpnhgspghrtghpthhtohepuddprhgtphhtthhopehffhhmphgvghdquggvvhgvlhesfhhfmhhpvghgrdhorhhg X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 3/3] avcodec/osq: Switch back to av_ceil_log2() 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: This returns to code closer to prior 56c334d732dbbce43b0c8fc0809ec545b7946832 The prior fixes should limit the sum and avoid the need for double argument log2() Fixes: Assertion n>=0 && n<=32 failed at libavcodec/get_bits.h:406 Fixes: 410109093/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OSQ_fuzzer-6550900028276736 No testcases except fuzzers Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/osq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/osq.c b/libavcodec/osq.c index d3b1d86ee35..025be667a35 100644 --- a/libavcodec/osq.c +++ b/libavcodec/osq.c @@ -165,7 +165,8 @@ static int update_residue_parameter(OSQChannel *cb) if (!sum) return 0; x = sum / cb->count; - rice_k = ceil(log2(x)); + av_assert2(x <= 0x80000000U); + rice_k = av_ceil_log2(x); if (rice_k >= 30) { double f = floor(sum / 1.4426952 + 0.5); if (f <= 1) { -- 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".