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 BC06A48880 for ; Wed, 16 Jul 2025 00:53:04 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 3754868DEBC; Wed, 16 Jul 2025 03:52:23 +0300 (EEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 0876368D8ED for ; Wed, 16 Jul 2025 03:52:13 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 4C8E744267 for ; Wed, 16 Jul 2025 00:52:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1752627133; 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=NQVnBR2fqBe7Zv/dOe58xoxaIokLJw82sgOoWNna+q8=; b=YhfkGVMamBW9War/jYFa9YIMGl7eEu2l9o/QhESOJjsQqbjZH7CwaiQQX7wRI8yk0gs1UB 95Q+E7BqUutJUjqjzFx3BjwnnwWAUFFD0kVU3ZeN8wj7qyrTpKdDqM+xSCYtHpEie5p3AW ZefdHu34r8BXU46Y9lIfos1dTH0nOsixqXhPGfgxgCejs6gncSEwIeUTUXTltz2xeKdfZA fj6omrJZM14cOSEf2TgmzEZKyUteDm5AM1eUOkUPJZOKAkjRtqiWt6LL6UZKhMbH0B1LGO 4eRFjzTeI/9Dm61TPGwGOtNf7VnI4RvL+gQkHturOZ1L/2w1e9QaiyfmTBzY1Q== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Wed, 16 Jul 2025 02:52:07 +0200 Message-ID: <20250716005208.4109775-4-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: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdehieefudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrhhlucfvnfffucdludehmdenucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofhitghhrggvlhcupfhivgguvghrmhgrhigvrhcuoehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgeqnecuggftrfgrthhtvghrnhepgeejhfetgefhgfeludegvdduvdffgeefvddtheetlefhueeitdevffevfeehhefgnecuffhomhgrihhnpehgihhthhhusgdrtghomhenucfkphepgedurdeiiedrieehrddujeeinecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepgedurdeiiedrieehrddujeeipdhhvghloheplhhotggrlhhhohhsthdpmhgrihhlfhhrohhmpehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgdpnhgspghrtghpthhtohepuddprhgtphhtthhopehffhhmphgvghdquggvvhgvlhesfhhfmhhpvghgrdhorhhg X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 4/5] avcodec/jpeg2000dec: Check that we arent reading with a non existing tile part 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: applying zero offset to null pointer Fixes: 429330004/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_DEC_fuzzer-4733213845291008 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/jpeg2000dec.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c index b82d85d5ee5..0e867025a38 100644 --- a/libavcodec/jpeg2000dec.c +++ b/libavcodec/jpeg2000dec.c @@ -1156,6 +1156,10 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile, else select_stream(s, tile, tp_index, codsty); + // refering to a non existing tile part + if (!s->g.buffer) + return AVERROR_INVALIDDATA; + if (!(ret = get_bits(s, 1))) { jpeg2000_flush(s); goto skip_data; @@ -1868,7 +1872,8 @@ static int jpeg2000_decode_packets(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile ); } /* EOC marker reached */ - bytestream2_skip(&s->g, 2); + if (ret >= 0) + bytestream2_skip(&s->g, 2); return ret; } -- 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".