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 C76CD490DE for ; Wed, 31 Jul 2024 19:49:57 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 20F1868D7EA; Wed, 31 Jul 2024 22:49:55 +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 6612568D5FE for ; Wed, 31 Jul 2024 22:49:49 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 8C11A20003 for ; Wed, 31 Jul 2024 19:49:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1722455388; 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=ymlfou9cuxU9xyLp2I7Y/0XOnvXFDA5yUlab9aYhrvc=; b=ndU8cDJgMIx4hh8Jozp9bN5rdQPMfnaecPfErUD3/n+OuL9mT9bGJXlyI2aB9TYEgeuL+v JbAsztIY4Ox3LOsTiYpm9EGxnmUtryXbgHsUzg9NHxMS0VsoNpUiWoVHT+cSpDqvV9Ca3b WhY346q/oW62bYyCSO4QV8L0HLIBTbZwaqv7CvOBEDBL5Dl7QkKFGD4uYYJVVs95qWs9U8 eiNF/+5juCiPCttIFnQgSBD3lF+SK7o1EDYhuYZU0rPQKtVWgX9atlAI4fxCN/SkOkFkvZ 9HfbxFSZwMrPtf6wFGXCEstB/nVRzic1WGiAS4a/Y0bxvBFTPavA0VuxnzkzWQ== Date: Wed, 31 Jul 2024 21:49:47 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20240731194947.GW4991@pb2> References: <20240618134826.2189719-1-michael@niedermayer.cc> <20240715135912.GH4991@pb2> MIME-Version: 1.0 In-Reply-To: <20240715135912.GH4991@pb2> X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH 1/7] avcodec/utils: apply the same alignment to YUV410 as we do to YUV420 when motion estimation is used 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="===============0474617168238849378==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============0474617168238849378== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="XC5GIdCAi0ueCExh" Content-Disposition: inline --XC5GIdCAi0ueCExh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jul 15, 2024 at 03:59:12PM +0200, Michael Niedermayer wrote: > On Tue, Jun 18, 2024 at 07:28:18PM +0200, Andreas Rheinhardt wrote: > > Michael Niedermayer: > > > The snow encoder uses block based motion estimation which can read ou= t of array if > > > insufficient alignment is used > > >=20 > > > Fixes: out of array access > > > Fixes: 68963/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SNOW_f= uzzer-4979988435632128 > > > Fixes: 68969/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SNOW_f= uzzer-6239933667803136.fuzz > > >=20 > > > Found-by: continuous fuzzing process https://github.com/google/oss-fu= zz/tree/master/projects/ffmpeg > > > Signed-off-by: Michael Niedermayer > > > --- > > > libavcodec/utils.c | 3 +++ > > > 1 file changed, 3 insertions(+) > > >=20 > > > diff --git a/libavcodec/utils.c b/libavcodec/utils.c > > > index 337c00e789a..7914f799041 100644 > > > --- a/libavcodec/utils.c > > > +++ b/libavcodec/utils.c > > > @@ -259,6 +259,9 @@ void avcodec_align_dimensions2(AVCodecContext *s,= int *width, int *height, > > > if (s->codec_id =3D=3D AV_CODEC_ID_SVQ1) { > > > w_align =3D 64; > > > h_align =3D 64; > > > + } else if (s->codec_id =3D=3D AV_CODEC_ID_SNOW) { > > > + w_align =3D 16; > > > + h_align =3D 16; > > > } > > > break; > > > case AV_PIX_FMT_RGB555: > >=20 > > avcodec_align_dimensions2() is for decoders and happens to be used by > > ff_encode_alloc_frame(), too. But decoders should not be required to add > > more padding because the decoder needs more. Instead the encoder should > > add more padding itself (by using more than 2 * EDGE_WIDTH). >=20 > If you have verified that the decoder alignment is sufficient and 4:1:0 d= oes not > need the alignment that 4:2:0 has for snow, then yes i can mess with some > EDGE_WIDTH uses in snow to fix the encoder crash >=20 > Again the snow decoder for 4:2:0 has 16x16 alignment, 4:1:0 has not > and its identical in the encoders > This is why it crashes, the patch corrects this difference. > I do not think thats a great differernce to have >=20 > If we keep the 4:2:0 and 4:1:0 difference in alignment then > what should i do about the encoder ? > adjust EDGE_WIDTH for 4:1:0 only ? because 4:2:0 has the buffer dimension= s aligned correctly > so it doesnt need it bumped up? >=20 > That would result in 4:2:0 having the alignment from avcodec_align_dimens= ions2() for > decoder and encoder > and for 4:1:0 we would achieve something comparable with EDGE_WIDTH encod= er side only > and hope the decoder doesnt need it >=20 > This just doesnt sound like a step in the right direction > Also this as a security fix should be simple Will apply the original patch with a note that its not the ideal solution i dont want to leave this issue open while noone seems working on it thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Republics decline into democracies and democracies degenerate into despotisms. -- Aristotle --XC5GIdCAi0ueCExh Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZqqVVwAKCRBhHseHBAsP q8DtAJsERUzyqOlot+bPzuraOjQuyO7azgCeNxNNU5rs3ZZE8XLLkFTbQFR539Y= =8JIj -----END PGP SIGNATURE----- --XC5GIdCAi0ueCExh-- --===============0474617168238849378== 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". --===============0474617168238849378==--