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 6A57348810 for ; Wed, 16 Jul 2025 00:52:49 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 74B5C68DD93; Wed, 16 Jul 2025 03:52:21 +0300 (EEST) Received: from relay15.mail.gandi.net (relay15.mail.gandi.net [217.70.178.235]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id BE4E368DC58 for ; Wed, 16 Jul 2025 03:52:12 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id F2492431A6 for ; Wed, 16 Jul 2025 00:52:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1752627132; 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=ctLZRCJXOGPunRgtWQ6O7XSXcE5dO127QEksgaSJjGI=; b=C+SsaRnNCqGtdPaOpZUeYX6DSj12UUnPZMu7xOxzZP/jv/0xCt5g4xwT1eaMtXhfUX8xsY 8dNoi/XY08/hf7CDfPpbBlhDgdyfwdUqnG1e5LVxpTxbo/M+5pXQjD5ghut2sAT81VY3BS n8LJuJ0Ea+WQ00W9QO8huHI1s+Po7j0F4yBuFw2RDChFbvgTpoW9F5af/VKZh10h3bnv8g YRgAQ26669g9i5w5LKio6gT7NJYUXjA8LHWaZMp1Z7upOHQXrEyET2q1+7hZPkqx2lJp1C 8otPnyUvTleZNFNH6JTdY+XI9d+aeEqm6jj76CEX3KgdNUzJSkHx9fq193M34Q== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Wed, 16 Jul 2025 02:52:06 +0200 Message-ID: <20250716005208.4109775-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250716005208.4109775-1-michael@niedermayer.cc> References: <20250716005208.4109775-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-State: clean X-GND-Score: -85 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdehieefvdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrhhlucfvnfffucdludehmdenucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofhitghhrggvlhcupfhivgguvghrmhgrhigvrhcuoehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgeqnecuggftrfgrthhtvghrnhepgeejhfetgefhgfeludegvdduvdffgeefvddtheetlefhueeitdevffevfeehhefgnecuffhomhgrihhnpehgihhthhhusgdrtghomhenucfkphepgedurdeiiedrieehrddujeeinecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepgedurdeiiedrieehrddujeeipdhhvghloheplhhotggrlhhhohhsthdpmhgrihhlfhhrohhmpehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgdpnhgspghrtghpthhtohepuddprhgtphhtthhopehffhhmphgvghdquggvvhgvlhesfhhfmhhpvghgrdhorhhg Subject: [FFmpeg-devel] [PATCH 3/5] avcodec/ffv1dec: Check k in get_vlc_symbol() 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: The true problem happens in several previous get_vlc_symbol() but checking that is more expensive (involving FFABS()) here its just a simple check between 2 variables we have. Fixes: Assertion log >= k failed at libavcodec/golomb.h:406 Fixes: 429296194/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFV1_DEC_fuzzer-4691594622337024 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/ffv1dec.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c index d613aa53959..d709e8ccbb3 100644 --- a/libavcodec/ffv1dec.c +++ b/libavcodec/ffv1dec.c @@ -56,6 +56,11 @@ static inline int get_vlc_symbol(GetBitContext *gb, VlcState *const state, k++; i += i; } + if (k > bits) { + ff_dlog(NULL, "k-overflow bias:%d error:%d drift:%d count:%d k:%d", + state->bias, state->error_sum, state->drift, state->count, k); + k = bits; + } v = get_sr_golomb(gb, k, 12, bits); ff_dlog(NULL, "v:%d bias:%d error:%d drift:%d count:%d k:%d", -- 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".