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 25E31444AF for ; Sat, 12 Nov 2022 23:44:12 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6A7A268BA06; Sun, 13 Nov 2022 01:44:09 +0200 (EET) Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3086A68A241 for ; Sun, 13 Nov 2022 01:44:03 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 34A08FF805 for ; Sat, 12 Nov 2022 23:44:01 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 13 Nov 2022 00:43:59 +0100 Message-Id: <20221112234401.24158-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH 1/3] avformat/lafdec: Check for EOF in header reading 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: OOM testcase Fixes: 51527/clusterfuzz-testcase-minimized-ffmpeg_dem_LAF_fuzzer-5453663505612800 OOM can still happen after this as an arbitrary sized block is allocated and read this would require a redesign or some limit on the sample rate. Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/lafdec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/lafdec.c b/libavformat/lafdec.c index 12b0d8540b..d02b479c4d 100644 --- a/libavformat/lafdec.c +++ b/libavformat/lafdec.c @@ -111,6 +111,9 @@ static int laf_read_header(AVFormatContext *ctx) sample_rate = avio_rl32(pb); duration = avio_rl64(pb) / st_count; + if (avio_feof(pb)) + return AVERROR_INVALIDDATA; + switch (quality) { case 0: codec_id = AV_CODEC_ID_PCM_U8; -- 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".