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 1A26A449E4 for ; Wed, 28 Sep 2022 20:03:41 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BEF3E68BC0E; Wed, 28 Sep 2022 23:03:38 +0300 (EEST) Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5DBB368BBDD for ; Wed, 28 Sep 2022 23:03:32 +0300 (EEST) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 41CD9100003 for ; Wed, 28 Sep 2022 20:03:30 +0000 (UTC) Date: Wed, 28 Sep 2022 22:03:30 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20220928200330.GA6583@pb2> References: <20220928193925.GZ6583@pb2> MIME-Version: 1.0 In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH] swscale/swscale_unscaled: Fix undefined NULL + 0 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="===============7531964715998717842==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============7531964715998717842== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="qD80nKKiJWXm4UaL" Content-Disposition: inline --qD80nKKiJWXm4UaL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 28, 2022 at 09:43:56PM +0200, Andreas Rheinhardt wrote: > Michael Niedermayer: > > On Wed, Sep 28, 2022 at 08:39:09PM +0200, Andreas Rheinhardt wrote: > >> Affected the fitsdec-gbrp16 FATE-test. > >> > >> Signed-off-by: Andreas Rheinhardt > >> --- > >> libswscale/swscale_unscaled.c | 6 +++--- > >> 1 file changed, 3 insertions(+), 3 deletions(-) > >> > >> diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscal= ed.c > >> index 8838cc8b53..0b97377934 100644 > >> --- a/libswscale/swscale_unscaled.c > >> +++ b/libswscale/swscale_unscaled.c > >> @@ -695,7 +695,7 @@ static void packed16togbra16(const uint8_t *src, i= nt srcStride, > >> } > >> } > >> for (i =3D 0; i < 4; i++) > >> - dst[i] +=3D dstStride[i] >> 1; > >> + dst[i] =3D FF_PTR_ADD(dst[i], dstStride[i] >> 1); > >> } > >> } > >> =20 > >> @@ -729,8 +729,8 @@ static int Rgb16ToPlanarRgb16Wrapper(SwsContext *c= , const uint8_t *src[], > >> } > >> =20 > >> for(i=3D0; i<4; i++) { > >> - dst2013[i] +=3D stride2013[i] * srcSliceY / 2; > >> - dst1023[i] +=3D stride1023[i] * srcSliceY / 2; > >> + dst2013[i] =3D FF_PTR_ADD(dst2013[i], stride2013[i] * srcSlic= eY / 2); > >> + dst1023[i] =3D FF_PTR_ADD(dst1023[i], stride1023[i] * srcSlic= eY / 2); > >> } > >=20 > > is there a reason not to check the pointer in the loop ? > > as in > > for (i =3D 0; i < 4 && dst[i]; i++) > >=20 >=20 > I consider NULL + 0 to be sane and would be happy to see it being > defined in a future version of the spec.=20 i agree but that will not help our code for a long time > So I don't like adding checks > to workaround the insanities of the spec.=20 Ive seen this less as a workaround and more as a "only work on the active/used pointers" a dst[i] check is more used elsewhere in sws too but i really dont have much of an oppinon libswscale/slice.c: for (i =3D 0; i < 4 && src[i] !=3D NULL; ++i) { libswscale/swscale.c: for (i =3D 0; i < 4 && src2[i]; i++) { libswscale/swscale.c: for (i =3D 0; i < 4 && dst2[i]; i++) { libswscale/swscale_unscaled.c: for (plane =3D 0; plane < 4 && dst[plane]= !=3D NULL; plane++) { libswscale/tests/swscale.c: for (i =3D 0; i < 4 && dstStride[i]; i++) libswscale/swscale.c: for (int i =3D 0; i < FF_ARRAY_ELEMS(dst) && p= arent->frame_dst->data[i]; i++) { [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Observe your enemies, for they first find out your faults. -- Antisthenes --qD80nKKiJWXm4UaL Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCYzSojgAKCRBhHseHBAsP q6h6AKCOkRyqL0nOuJkaQNw2jkKUSRRktgCfYr4Hh2I6SkdtJs9KJyTURpoz9Eo= =2023 -----END PGP SIGNATURE----- --qD80nKKiJWXm4UaL-- --===============7531964715998717842== 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". --===============7531964715998717842==--