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 7BA8648063 for ; Wed, 8 May 2024 19:49:13 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 10FA368D6DB; Wed, 8 May 2024 22:49:11 +0300 (EEST) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DC6A26801F2 for ; Wed, 8 May 2024 22:49:04 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 31CEA1C0002 for ; Wed, 8 May 2024 19:49:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1715197744; 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=88KwWNY+QObxmdwHuXU1KGCtkcyHpjeckIbSCt7UNQE=; b=llQPMOJ6b/tnfI/kgbKPo5B2lmpvdSWCC2uPk3Vdlq3BytpXGP3blr1l1LkbLdJpUavCgd lDrMCp2BgfjXdVBWQmGAlX4FXFj+2qVLdlWg27Z3kf3fydjeYA/7heOIBnkxTn1UQ6bMlO uIMojagJ8XoK0g37aBEgqbVj9PqAcxhOLiAWFRkPAjjtuinKVXHzj9ggRRTjg+4Q/jxO/f hexzl/DdhVefyoA4aggfAbgtTbajTyXzVPuVo0a76GDOF6YKE9HfjEm15WIJitq6zo2P1v eCyNH/aH0tYTxsMq6OvG1eiw+AX4CE2vZLVE1ON3aDT+6EJbu2sfnYzesFJN9A== Date: Wed, 8 May 2024 21:49:03 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20240508194903.GG6420@pb2> References: <20240508023923.28209-1-michael@niedermayer.cc> MIME-Version: 1.0 In-Reply-To: X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH 1/3] avcodec/cbs_jpeg: Assert that cbs_jpeg_assemble_fragment() stays within the 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="===============0671093624567463702==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============0671093624567463702== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ZitXAaPuoCswE17s" Content-Disposition: inline --ZitXAaPuoCswE17s Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 08, 2024 at 11:46:45AM +0200, Andreas Rheinhardt wrote: > Michael Niedermayer: > > Inspired by: CID1473561 Untrusted pointer write > >=20 > > Sponsored-by: Sovereign Tech Fund > > Signed-off-by: Michael Niedermayer > > --- > > libavcodec/cbs_jpeg.c | 1 + > > 1 file changed, 1 insertion(+) > >=20 > > diff --git a/libavcodec/cbs_jpeg.c b/libavcodec/cbs_jpeg.c > > index b1b58dcd65e..628841c5f37 100644 > > --- a/libavcodec/cbs_jpeg.c > > +++ b/libavcodec/cbs_jpeg.c > > @@ -401,6 +401,7 @@ static int cbs_jpeg_assemble_fragment(CodedBitstrea= mContext *ctx, > > } else { > > data[dp++] =3D unit->data[sp]; > > } > > + av_assert0(dp <=3D size - 2); > > } > > } > > } >=20 > You want to add an av_assert0 to a hot loop (or rather: to what would be > a hot loop in case this code were executed) just because Coverity thinks > that reading data with a different endianness taints this data? (That > the supposedly tainted variable has actually already been checked via an > assert makes this even more crazy.) patch droped But the code is fragile, there are 2 loops that must match exactly if what the second writes doesnt match what the first counts it writes out of array This just needs someone finding a bug in the loop and fix it without updating the 2nd loop 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. --ZitXAaPuoCswE17s Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZjvXKwAKCRBhHseHBAsP qxyYAJ4miBEeNfDInbpd74qY9WIsz533QwCfZtzBNpOKsBwzFohLp7aFzguGymM= =k0Ni -----END PGP SIGNATURE----- --ZitXAaPuoCswE17s-- --===============0671093624567463702== 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". --===============0671093624567463702==--