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 0BCA148FCB for ; Mon, 1 Apr 2024 16:05:37 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 45DB568CDD9; Mon, 1 Apr 2024 19:05:34 +0300 (EEST) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D75F768C2D6 for ; Mon, 1 Apr 2024 19:05:27 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 0771320003 for ; Mon, 1 Apr 2024 16:05:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1711987527; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=P39W1YYh/qqPhzDD+hIO2AfM9rMjG+qpyoSUhpPmYqs=; b=PgGquILKCVu7EIQVJBVYq9j6EswXShaGDQTYo52b/HXG7oR+fYW2hoxKzOqd2SWVYY7T94 DrEfQd06CxEOoNyKLtsHX8Zz8n1JM5cea9SiFgEqwS0eBrWkz10DNsEUbbRHQjbUOmlgGx R3djl+nYZxuDKpVVBsdCeUc3p/A2PmXjl5/eXQYOriOGTp9b/QxksUkOwW8DQjISVzHm/M ATvb3Ytyvx/EDz2rlrfS81aNEULY8WTmM1oKDwXfU34QRNp0f8mio4p2D/tNuGypbyagKK LJQXbyOEaEApRebZWWQjsFY/ujjptr9xxzXwH1T9YFZXyg8Ik3hdCs/nK62V+g== Date: Mon, 1 Apr 2024 18:05:26 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20240401160526.GD6420@pb2> References: <20240329193221.11522-1-michael@niedermayer.cc> <20240329193221.11522-3-michael@niedermayer.cc> <6a58357078006fb414af6f170d0ea3aa8c2ce2b5.camel@haerdin.se> MIME-Version: 1.0 In-Reply-To: <6a58357078006fb414af6f170d0ea3aa8c2ce2b5.camel@haerdin.se> X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH 3/3] avformat/mxfdec: Check first case of offset_temp computation for overflow 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="===============4393628077262362405==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============4393628077262362405== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="SQmCzhPcL5SAXAN2" Content-Disposition: inline --SQmCzhPcL5SAXAN2 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Mar 30, 2024 at 10:01:32AM +0100, Tomas H=E4rdin wrote: > fre 2024-03-29 klockan 20:32 +0100 skrev Michael Niedermayer: > > This is kind of ugly > > Fixes: signed integer overflow: 255 * 1157565362826411919 cannot be > > represented in type 'long' > > Fixes: 67313/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer- > > 6250434245230592 > >=20 > > Found-by: continuous fuzzing process > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > Signed-off-by: Michael Niedermayer > > --- > > =A0libavformat/mxfdec.c | 9 +++++++-- > > =A01 file changed, 7 insertions(+), 2 deletions(-) > >=20 > > diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c > > index c9af4628555..fe86f516630 100644 > > --- a/libavformat/mxfdec.c > > +++ b/libavformat/mxfdec.c > > @@ -1891,9 +1891,14 @@ static int > > mxf_edit_unit_absolute_offset(MXFContext *mxf, MXFIndexTable *index_t > > =A0=A0=A0=A0=A0=A0=A0=A0 if (edit_unit < s->index_start_position + s->i= ndex_duration) > > { > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 int64_t index =3D edit_unit - s->i= ndex_start_position; > > =A0 > > -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (s->edit_unit_byte_count) > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (s->edit_unit_byte_count) { > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (s->edit_unit_byte_co= unt * (uint64_t)index / s- > > >edit_unit_byte_count !=3D index || >=20 > Don't we already have a function for testing these kinds of overflows We have av_size_mult() thats for size_t > for av_calloc()? Or do it manually less uglily like so: >=20 > index > INT64_MAX / s->edit_unit_byte_count ok >=20 > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 s->edit_unit= _byte_count * index > INT64_MAX - > > offset_temp > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ) >=20 > Nit: looks a bit weird to have the ) there rather than at the end of > the previous line will push with this changed thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Rewriting code that is poorly written but fully understood is good. Rewriting code that one doesnt understand is a sign that one is less smart than the original author, trying to rewrite it will not make it better. --SQmCzhPcL5SAXAN2 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZgrbQwAKCRBhHseHBAsP q4SuAJ9emp/Pp2bo3G6EGjvM/k2gWzsp2wCeN2Zri77pQtbWzpLqlNsf2nKTcgE= =I8FG -----END PGP SIGNATURE----- --SQmCzhPcL5SAXAN2-- --===============4393628077262362405== 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". --===============4393628077262362405==--