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 A7D6940A18 for ; Sat, 25 Dec 2021 10:43:51 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 42F3C68B0FD; Sat, 25 Dec 2021 12:43:50 +0200 (EET) 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 C46C568B0DC for ; Sat, 25 Dec 2021 12:43:42 +0200 (EET) Received: from localhost (213-47-68-29.cable.dynamic.surfer.at [213.47.68.29]) (Authenticated sender: michael@niedermayer.cc) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id F0030E0006 for ; Sat, 25 Dec 2021 10:43:41 +0000 (UTC) Date: Sat, 25 Dec 2021 11:43:41 +0100 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20211225104341.GS2829255@pb2> References: <20211223211527.20408-1-michael@niedermayer.cc> <20211223211527.20408-5-michael@niedermayer.cc> <08d87b86-6c41-5474-7303-9527cf6755cf@personalprojects.net> <20211224165800.GN2829255@pb2> <1884aaa4-e6f2-fc58-d2de-8fe92cd79ecf@personalprojects.net> MIME-Version: 1.0 In-Reply-To: <1884aaa4-e6f2-fc58-d2de-8fe92cd79ecf@personalprojects.net> Subject: Re: [FFmpeg-devel] [PATCH 5/5] avformat/mvdec: Check bytes_per_sample 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: multipart/mixed; boundary="===============4412781676681872117==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============4412781676681872117== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="QT6qLb6kqiXQcZxP" Content-Disposition: inline --QT6qLb6kqiXQcZxP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Dec 24, 2021 at 03:29:50PM -0500, John-Paul Stewart wrote: > On 2021-12-24 11:58, Michael Niedermayer wrote: > > On Thu, Dec 23, 2021 at 10:32:12PM -0500, John-Paul Stewart wrote: > >> On 2021-12-23 16:15, Michael Niedermayer wrote: > >>> Fixes: division by zero > >>> Fixes: 42814/clusterfuzz-testcase-minimized-ffmpeg_dem_MV_fuzzer-4787= 014237552640 > >>> > >>> Found-by: continuous fuzzing process https://github.com/google/oss-fu= zz/tree/master/projects/ffmpeg > >>> Signed-off-by: Michael Niedermayer > >>> --- > >>> libavformat/mvdec.c | 3 +++ > >>> 1 file changed, 3 insertions(+) > >>> > >>> diff --git a/libavformat/mvdec.c b/libavformat/mvdec.c > >>> index 1a5012e5076..390f6ba4de8 100644 > >>> --- a/libavformat/mvdec.c > >>> +++ b/libavformat/mvdec.c > >>> @@ -366,6 +366,9 @@ static int mv_read_header(AVFormatContext *avctx) > >>> avpriv_request_sample(avctx, "Audio compression (format = %i)", v); > >>> } > >>> =20 > >>> + if (bytes_per_sample <=3D 0) > >>> + return AVERROR_INVALIDDATA; > >>> + > >> > >> bytes_per_sample is uint32_t so it can never be less than zero. > >> > >> bytes_per_sample will be zero for movie files with no audio, so that is > >> not necessarily invalid data. >=20 > I have to retract that comment. Sorry for the confusion. >=20 > Now that I've had time to delve into it further, the Silicon Graphics > format will fill in a placeholder audio track (16 bit stereo, 22050 Hz) > even when there is no actual audio. So even movies with no sound will > have bytes_per_sample > 0. >=20 > > i can change it to AVERROR_PATCHWELCOME but this codepath has already > > created a audio stream so the code at least belives at this point that > > there is audio and it will crash a few lines later > >=20 > >> > >> I can't offer a better suggestion at the moment, though. I'll see if > >> can come up with something, unless one of you guys gets to it first. > >=20 > > ok, ill apply this unless i see another fix first as it fixes the crash > > and in fact in this path requests for samples where already printed also >=20 > The real issue is that the audio stream is always allocated even when > there is no audio. Fixing that is a project for another day. Don't let > me stop you from applying the above patch. ok will apply [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Breaking DRM is a little like attempting to break through a door even though the window is wide open and the only thing in the house is a bunch of things you dont want and which you would get tomorrow for free anyway --QT6qLb6kqiXQcZxP Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCYcb13QAKCRBhHseHBAsP qyEdAJ9+3kyrun6rdjSj6h9a305CNXPYqwCeMbGWupYtgm1NgX9W8N7uGDZ4mW0= =4CJe -----END PGP SIGNATURE----- --QT6qLb6kqiXQcZxP-- --===============4412781676681872117== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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". --===============4412781676681872117==--