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 0FE8B40FAB for ; Mon, 14 Mar 2022 13:58:30 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 13C8C68AFC9; Mon, 14 Mar 2022 15:58:28 +0200 (EET) Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A57B368A800 for ; Mon, 14 Mar 2022 15:58:21 +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 C3F1410000B for ; Mon, 14 Mar 2022 13:58:20 +0000 (UTC) Date: Mon, 14 Mar 2022 14:58:19 +0100 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20220314135819.GW2829255@pb2> References: <20220312235227.19626-1-michael@niedermayer.cc> <20220312235227.19626-3-michael@niedermayer.cc> <1e687354-29fa-6c18-2850-c1fe7da6bd42@passwd.hu> MIME-Version: 1.0 In-Reply-To: <1e687354-29fa-6c18-2850-c1fe7da6bd42@passwd.hu> Subject: Re: [FFmpeg-devel] [PATCH 3/4] avformat/mxfdec: Check for avio_read() failure 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="===============1239338126690907407==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============1239338126690907407== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="UczKLsMlX2W4LIA+" Content-Disposition: inline --UczKLsMlX2W4LIA+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Mar 13, 2022 at 04:52:25PM +0100, Marton Balint wrote: >=20 >=20 > On Sun, 13 Mar 2022, Michael Niedermayer wrote: >=20 > > Signed-off-by: Michael Niedermayer > > --- > > libavformat/mxfdec.c | 8 +++++++- > > 1 file changed, 7 insertions(+), 1 deletion(-) > >=20 > > diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c > > index d7cdd22c8a..828fc0f9f1 100644 > > --- a/libavformat/mxfdec.c > > +++ b/libavformat/mxfdec.c > > @@ -932,6 +932,7 @@ static int mxf_read_cryptographic_context(void *arg= , AVIOContext *pb, int tag, i > >=20 > > static int mxf_read_strong_ref_array(AVIOContext *pb, UID **refs, int *= count) > > { > > + int64_t ret; > > unsigned c =3D avio_rb32(pb); > >=20 > > //avio_read() used int > > @@ -946,7 +947,12 @@ static int mxf_read_strong_ref_array(AVIOContext *= pb, UID **refs, int *count) > > return AVERROR(ENOMEM); > > } > > avio_skip(pb, 4); /* useless size of objects, always 16 according t= o specs */ > > - avio_read(pb, (uint8_t *)*refs, *count * sizeof(UID)); > > + ret =3D avio_read(pb, (uint8_t *)*refs, *count * sizeof(UID)); > > + if (ret !=3D *count * sizeof(UID)) { > > + *count =3D ret < 0 ? 0 : ret / sizeof(UID); >=20 > I suggest you hard fail if the read count is not the expected, do not > silently ignore corrupt file. >=20 > Regards, > Marton >=20 > > + return ret < 0 ? ret : AVERROR_INVALIDDATA; Does it not hard fail here ? thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Take away the freedom of one citizen and you will be jailed, take away the freedom of all citizens and you will be congratulated by your peers in Parliament. --UczKLsMlX2W4LIA+ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCYi9J9wAKCRBhHseHBAsP q1wuAJ0TSGXRn0rmqaoFXpwiG8DFpWL7wgCeLnO5YEe8If92SDvBa+cmwrMVNCQ= =g2b1 -----END PGP SIGNATURE----- --UczKLsMlX2W4LIA+-- --===============1239338126690907407== 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". --===============1239338126690907407==--