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 2437E4BBD0 for ; Mon, 15 Jul 2024 13:59:24 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9B79068DA79; Mon, 15 Jul 2024 16:59:21 +0300 (EEST) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AD1F268D7F8 for ; Mon, 15 Jul 2024 16:59:14 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 90B5E240007 for ; Mon, 15 Jul 2024 13:59:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1721051953; 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=Jwb/F3TcF5KWUEsRrPJOoMy/ccpWGVO7C6BQpBEMLaI=; b=GOWz/H3b8Ovsqd7SLW2szsqQ7MCeqc/tv70hWHQVHLKjQRfIL3uzZOhuJHw7+NlZwdA2Zz +eVWu7Z4KVniK3+kYiSzYPqAmKefctck/hoh0hOOTuEnxmgPVXbHQ+Mps6Ok1qK3rogCiY KWAPpHn2xIAmNqwoPGIN4bWGPPkhAD6StRuD1y5TC+rgznu5ERsY5KfS485KzOCYuvQggo uuGsMuJtkCDx+0CTWwWLBhv2vTGeZDl9UiM8vZfvuMRMQRiP6pEVfzQFo+b1XdE34fqzSy Bie4dcAV9v7Q/ZVPeVHNH3J4Kp6JUBZWGN6CIzr3IsjF/hQVLJJNYChPoi4kVQ== Date: Mon, 15 Jul 2024 15:59:12 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20240715135912.GH4991@pb2> References: <20240618134826.2189719-1-michael@niedermayer.cc> MIME-Version: 1.0 In-Reply-To: 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="===============6138202735842457573==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============6138202735842457573== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="RAUcXqUVQkqOo8Xa" Content-Disposition: inline --RAUcXqUVQkqOo8Xa Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 out = of array if > > insufficient alignment is used > >=20 > > Fixes: out of array access > > Fixes: 68963/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SNOW_fuz= zer-4979988435632128 > > Fixes: 68969/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SNOW_fuz= zer-6239933667803136.fuzz > >=20 > > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz= /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, i= nt *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). If you have verified that the decoder alignment is sufficient and 4:1:0 doe= s 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 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 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 dimensions = aligned correctly so it doesnt need it bumped up? That would result in 4:2:0 having the alignment from avcodec_align_dimensio= ns2() for decoder and encoder and for 4:1:0 we would achieve something comparable with EDGE_WIDTH encoder= side only and hope the decoder doesnt need it This just doesnt sound like a step in the right direction Also this as a security fix should be simple thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB It is a danger to trust the dream we wish for rather than the science we have, -- Dr. Kenneth Brown --RAUcXqUVQkqOo8Xa Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZpUrLQAKCRBhHseHBAsP qzmqAJ9KBA+vdxQA/hK6NNyN8X94v/MQLACfY+9v4BiN3l02giLJDEM2smlKiYg= =COq4 -----END PGP SIGNATURE----- --RAUcXqUVQkqOo8Xa-- --===============6138202735842457573== 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". --===============6138202735842457573==--