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 DC46546912 for ; Fri, 21 Jun 2024 21:09:57 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5DF2668D760; Sat, 22 Jun 2024 00:09:54 +0300 (EEST) Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8058B68D5D4 for ; Sat, 22 Jun 2024 00:09:47 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id A0C2960002 for ; Fri, 21 Jun 2024 21:09:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1719004186; 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=Ar5t3bUnN+gHNvSTKpas5sIFPjDjEpzgKUUNaA28lOQ=; b=duKjmpL1gUjz2+FCnWbsVunqk6s+iJuJbT3Q17pSRwMA9EpdLV5eTK0c33J6IRnlYY+8b0 WpQE0FUF5Vg51WtzDtRCUbMrvPOD0mDvM6LhHdgg8fkYWfSyiHsL/nlMP5j8smNJ+M9i2J 8lPpWLaNpUms0XIdIwnbeuO533EJtCfK7jFYhsKUngGVWaYYIKIYXyTDXNxEqYmU/MdhZf xqH6rvL2Ma9lACb4Ydu21f6lc6GBld6Yga0weI28wwD01gZJ60+qg0FKPl5wwS4XtCTdgh 6x0BIKJD90pYCeCH9wggiEJzJSfFJvIsWLSOziCU5sG8Pab6vxq+L+KNTBrObg== Date: Fri, 21 Jun 2024 23:09:45 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20240621210945.GU4991@pb2> References: <20240620193504.2310780-1-michael@niedermayer.cc> MIME-Version: 1.0 In-Reply-To: X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH 1/4] avcodec/j2kenc: Merge dwt_norm into lambda 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="===============1232290835036056058==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============1232290835036056058== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="MjBORTcaENZKFEO1" Content-Disposition: inline --MjBORTcaENZKFEO1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 21, 2024 at 11:38:46AM +0200, Andreas Rheinhardt wrote: > Michael Niedermayer: > > This moves computations out of a loop > >=20 > > Fixes: signed integer overflow: 31665934879948800 * 9998 cannot be repr= esented in type 'long' > > Fixes: 69024/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000= _fuzzer-5949662967169024 > >=20 > > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz= /tree/master/projects/ffmpeg > > Signed-off-by: Michael Niedermayer > > --- > > libavcodec/j2kenc.c | 9 +++++---- > > 1 file changed, 5 insertions(+), 4 deletions(-) > >=20 > > diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c > > index 8cf82f7216c..91e66d81048 100644 > > --- a/libavcodec/j2kenc.c > > +++ b/libavcodec/j2kenc.c > > @@ -1349,7 +1349,7 @@ static void makelayers(Jpeg2000EncoderContext *s,= Jpeg2000Tile *tile) > > } > > } > > =20 > > -static int getcut(Jpeg2000Cblk *cblk, uint64_t lambda, int dwt_norm) > > +static int getcut(Jpeg2000Cblk *cblk, uint64_t lambda) > > { > > int passno, res =3D 0; > > for (passno =3D 0; passno < cblk->npasses; passno++){ > > @@ -1361,7 +1361,7 @@ static int getcut(Jpeg2000Cblk *cblk, uint64_t la= mbda, int dwt_norm) > > dd =3D cblk->passes[passno].disto > > - (res ? cblk->passes[res-1].disto : 0); > > =20 > > - if (((dd * dwt_norm) >> WMSEDEC_SHIFT) * dwt_norm >=3D dr * la= mbda) > > + if (dd >=3D dr * lambda) > > res =3D passno+1; > > } > > return res; > > @@ -1384,11 +1384,12 @@ static void truncpasses(Jpeg2000EncoderContext = *s, Jpeg2000Tile *tile) > > Jpeg2000Band *band =3D reslevel->band + bandno; > > Jpeg2000Prec *prec =3D band->prec + precno; > > =20 > > + int64_t dwt_norm =3D dwt_norms[codsty->transform = =3D=3D FF_DWT53][bandpos][lev] * (int64_t)band->i_stepsize >> 15; > > + int64_t lambda_prime =3D av_rescale(s->lambda, 1 <= < WMSEDEC_SHIFT, dwt_norm * dwt_norm); > > for (cblkno =3D 0; cblkno < prec->nb_codeblocks_he= ight * prec->nb_codeblocks_width; cblkno++){ > > Jpeg2000Cblk *cblk =3D prec->cblk + cblkno; > > =20 > > - cblk->ninclpasses =3D getcut(cblk, s->lambda, > > - (int64_t)dwt_norms[codsty->transform = =3D=3D FF_DWT53][bandpos][lev] * (int64_t)band->i_stepsize >> 15); > > + cblk->ninclpasses =3D getcut(cblk, lambda_prim= e); > > cblk->layers[0].data_start =3D cblk->data; > > cblk->layers[0].cum_passes =3D cblk->ninclpass= es; > > cblk->layers[0].npasses =3D cblk->ninclpasses; >=20 > Does this also fix the UB in the vsynth*-jpeg2000-yuva444p16 tests? we will find out when this is applied, it looks like it might thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 2 "100% positive feedback" - "All either got their money back or didnt compla= in" "Best seller ever, very honest" - "Seller refunded buyer after failed scam" --MjBORTcaENZKFEO1 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZnXsFgAKCRBhHseHBAsP q7VbAJ95YJ6WYdC0DssD9WuawUzL5qUFjwCgjBcIqTwXvqKA8wD+qiFFVYButI0= =VBqI -----END PGP SIGNATURE----- --MjBORTcaENZKFEO1-- --===============1232290835036056058== 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". --===============1232290835036056058==--