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 5FBCB40097 for ; Sat, 19 Mar 2022 22:51:02 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3EFC168B084; Sun, 20 Mar 2022 00:51:00 +0200 (EET) 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 69D7468A67E for ; Sun, 20 Mar 2022 00:50:54 +0200 (EET) Received: from localhost (213-47-68-29.cable.dynamic.surfer.at [213.47.68.29]) (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id AF2FF20002 for ; Sat, 19 Mar 2022 22:50:53 +0000 (UTC) Date: Sat, 19 Mar 2022 23:50:52 +0100 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20220319225052.GD2829255@pb2> References: <20220312235227.19626-1-michael@niedermayer.cc> <20220312235227.19626-2-michael@niedermayer.cc> MIME-Version: 1.0 In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH 2/4] avformat/mxfdec: Check count in mxf_read_strong_ref_array() 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="===============6774488907581852713==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============6774488907581852713== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="adzDcEg6wVgk92dl" Content-Disposition: inline --adzDcEg6wVgk92dl Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 14, 2022 at 08:19:51PM +0100, Tomas H=E4rdin wrote: > s=F6n 2022-03-13 klockan 00:52 +0100 skrev Michael Niedermayer: > > Signed-off-by: Michael Niedermayer > > --- > > =A0libavformat/mxfdec.c | 8 +++++++- > > =A01 file changed, 7 insertions(+), 1 deletion(-) > >=20 > > diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c > > index b85c10bf19..d7cdd22c8a 100644 > > --- a/libavformat/mxfdec.c > > +++ b/libavformat/mxfdec.c > > @@ -932,7 +932,13 @@ static int mxf_read_cryptographic_context(void > > *arg, AVIOContext *pb, int tag, i > > =A0 > > =A0static int mxf_read_strong_ref_array(AVIOContext *pb, UID **refs, > > int *count) > > =A0{ > > -=A0=A0=A0 *count =3D avio_rb32(pb); > > +=A0=A0=A0 unsigned c =3D avio_rb32(pb); >=20 > not uint32_t? we dont need an exact length variable here >=20 > > + > > +=A0=A0=A0 //avio_read() used int > > +=A0=A0=A0 if (c > INT_MAX / sizeof(UID)) > > +=A0=A0=A0=A0=A0=A0=A0 return AVERROR_PATCHWELCOME; > > +=A0=A0=A0 *count =3D c; > > + >=20 > This should already be caught by av_calloc(), no? the API as in the documentation of av_calloc() does not gurantee this. Its bad practice if we write code that depends on some implementation of some code in a diferent module/lib thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Does the universe only have a finite lifespan? No, its going to go on forever, its just that you wont like living in it. -- Hiranya Peiri --adzDcEg6wVgk92dl Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCYjZeSAAKCRBhHseHBAsP q+d4AJ9iruy3D0JUjT9dwytzA6aWTvq0YACfeqgY7OsxKFBVCdDM9Lj3Cju7eqU= =THS7 -----END PGP SIGNATURE----- --adzDcEg6wVgk92dl-- --===============6774488907581852713== 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". --===============6774488907581852713==--