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 2153647FDD for ; Sun, 4 Aug 2024 20:53:30 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 342AB68D95A; Sun, 4 Aug 2024 23:53:19 +0300 (EEST) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F1B9868CFC0 for ; Sun, 4 Aug 2024 23:53:11 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 4193FE0003 for ; Sun, 4 Aug 2024 20:53:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1722804791; 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=lfJxWwyKIGLLaplgcnL1qEkGNZofDFE7hHth5RrTNB0=; b=QI5pa4R2I/qefcumwYEzcIgx1kHJ94uDiMeMbFDkgCrTapb5qvwJKBcczW72RxN4QafBDF 09eaE49Mdddl/8OhwUu2n0TcwtPff7s6s7COmnnxcAoH8KtCgEr1fxddDHnSSpI1moNZiu xrrPx9couUs5pvbqiPkrjjkjaZlGc901q498kruxN1Aas8kVmsKuQCX8bnRWQpJA53KE+2 2EMfbRilkbAF6Gqwr5HK/0gD0+5foqJTF7oO3KQbm9MxMg0PlKKCGX1dR5qICcgaZPpbuL 1yq8i6cQelQiZAZtcPOfqa+F++37nJniNe/yZviJHAHUt1tG2HYprxhUf6LZQA== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 4 Aug 2024 22:53:03 +0200 Message-ID: <20240804205309.1978196-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240804205309.1978196-1-michael@niedermayer.cc> References: <20240804205309.1978196-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 2/8] avformat/mpeg: Check an avio_read() for failure 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: use-of-uninitialized-value Fixes: 70849/clusterfuzz-testcase-minimized-ffmpeg_dem_MPEGPS_fuzzer-4684401009557504 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/mpeg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index c3dff3e4ea2..262e398fa5e 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -566,7 +566,9 @@ redo: static const unsigned char avs_seqh[4] = { 0, 0, 1, 0xb0 }; unsigned char buf[8]; - avio_read(s->pb, buf, 8); + ret = avio_read(s->pb, buf, 8); + if (ret < 0) + return ret; avio_seek(s->pb, -8, SEEK_CUR); if (!memcmp(buf, avs_seqh, 4) && (buf[6] != 0 || buf[7] != 1)) codec_id = AV_CODEC_ID_CAVS; -- 2.45.2 _______________________________________________ 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".