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 C06B248D47 for ; Sun, 23 Jun 2024 22:49:11 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4606D68D61B; Mon, 24 Jun 2024 01:49:08 +0300 (EEST) Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0A40768D42E for ; Mon, 24 Jun 2024 01:49:02 +0300 (EEST) Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-57d0699fd02so1912837a12.0 for ; Sun, 23 Jun 2024 15:49:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719182941; x=1719787741; darn=ffmpeg.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=oZHKr5cPWu2satcKBKFtGy5zKNsZmIHsnfsn4VxJmTo=; b=VOF5Gpd/FdjIuOjvHW5m9+J03ctvtuqwK+t2TvnPXg6U4YkmyQV//R1hFrg1uq0tLm msQmrFz5DGllg7er5JZxO9M0Afx7Kh566UvIyXJyJ4wslHezuXtc1hRo01ZaF1Sf7/iA Jo3ap/OgWZTegAIsSlgSNzzc+Q9PZYyBz1gDr7At8GQGxzFOFUadglCQ21F+ZFXqGCyW T3iwJDE55n9toJHvOkrN351xK/2D1YOA9QJauhEzaIRn98WuMQ9IQrh2zuNh3wRaR2Q5 1JtVcZ419kgOw2NgVIGzP2BESszyZ2JdtRt4Qp86DkClEFcE547jnV9Gy2GZvSn30+ZO TuEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719182941; x=1719787741; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oZHKr5cPWu2satcKBKFtGy5zKNsZmIHsnfsn4VxJmTo=; b=c74W98K6NeePNl3PMM3wpUVz3sToUMYmFqsnndQyPUF+etnL2ALAZhwe/U9YvrVrVA StzD18Ef1VmL8pbFRAbKgRz/AmX+i4QUhl2+RXrKSV3Ihu5fbXAIb7A/FCcuP+pKYNFK LUeZiaf0jJ4nUElwl7OAWcVnokamtXRDnGBKv4AIMl+zBeyTvSANvTxjk7IDRF8YapNa 38+KV0D7lpqo0RN1O/mrfPoaLGPoDPMt55YrMzDIv4mTv8/0/gOpGcVsa+/ZLmneEYVP sh5IFFN174k4LFg2mQ7X+r3Aw8YXllUZFu+nnCFCEe+EL4ZLNREOKyW/oLB9XSlJULXH bDDg== X-Gm-Message-State: AOJu0Yy/XiA5vfuOmUs91A4ISa9mt0O4ZcYUp79/u8rQOsiCfNxE6Xvi uRCEtH0iqjVy2g0i7oulKPfW0bAoueBTTfr2X1Gi5oUdyPqsKChsFQK4l0cnABXOf0lRDSqJ9Wx rg6MztElGTgvohexsfutBEIlwNNo0Zw== X-Google-Smtp-Source: AGHT+IHTw/YQWAFMI0X38vwI6T8Jy9xqVuhh+ag7Mj9dZXI0bPzu7kERtSLGaOQkSF53JBBVsc0uahaVSPnoCD2/WfY= X-Received: by 2002:a50:d697:0:b0:57d:3df:f881 with SMTP id 4fb4d7f45d1cf-57d4bd5a1femr2486161a12.3.1719182940725; Sun, 23 Jun 2024 15:49:00 -0700 (PDT) MIME-Version: 1.0 References: <20240620193504.2310780-1-michael@niedermayer.cc> In-Reply-To: From: Sean McGovern Date: Sun, 23 Jun 2024 18:48:48 -0400 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Hi, On Fri, Jun 21, 2024, 05:39 Andreas Rheinhardt < andreas.rheinhardt@outlook.com> wrote: > Michael Niedermayer: > > This moves computations out of a loop > > > > Fixes: signed integer overflow: 31665934879948800 * 9998 cannot be > represented in type 'long' > > Fixes: > 69024/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-5949662967169024 > > > > 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(-) > > > > 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) > > } > > } > > > > -static int getcut(Jpeg2000Cblk *cblk, uint64_t lambda, int dwt_norm) > > +static int getcut(Jpeg2000Cblk *cblk, uint64_t lambda) > > { > > int passno, res = 0; > > for (passno = 0; passno < cblk->npasses; passno++){ > > @@ -1361,7 +1361,7 @@ static int getcut(Jpeg2000Cblk *cblk, uint64_t > lambda, int dwt_norm) > > dd = cblk->passes[passno].disto > > - (res ? cblk->passes[res-1].disto : 0); > > > > - if (((dd * dwt_norm) >> WMSEDEC_SHIFT) * dwt_norm >= dr * > lambda) > > + if (dd >= dr * lambda) > > res = passno+1; > > } > > return res; > > @@ -1384,11 +1384,12 @@ static void truncpasses(Jpeg2000EncoderContext > *s, Jpeg2000Tile *tile) > > Jpeg2000Band *band = reslevel->band + bandno; > > Jpeg2000Prec *prec = band->prec + precno; > > > > + int64_t dwt_norm = dwt_norms[codsty->transform == > FF_DWT53][bandpos][lev] * (int64_t)band->i_stepsize >> 15; > > + int64_t lambda_prime = av_rescale(s->lambda, 1 << > WMSEDEC_SHIFT, dwt_norm * dwt_norm); > > for (cblkno = 0; cblkno < > prec->nb_codeblocks_height * prec->nb_codeblocks_width; cblkno++){ > > Jpeg2000Cblk *cblk = prec->cblk + cblkno; > > > > - cblk->ninclpasses = getcut(cblk, s->lambda, > > - (int64_t)dwt_norms[codsty->transform == > FF_DWT53][bandpos][lev] * (int64_t)band->i_stepsize >> 15); > > + cblk->ninclpasses = getcut(cblk, lambda_prime); > > cblk->layers[0].data_start = cblk->data; > > cblk->layers[0].cum_passes = cblk->ninclpasses; > > cblk->layers[0].npasses = cblk->ninclpasses; > > Does this also fix the UB in the vsynth*-jpeg2000-yuva444p16 tests? > > - Andreas > > _______________________________________________ > 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". > I'm on staycation for my local jazz festival all week. Was anyone able to test if this fixed the stuff Andreas mentioned? -- Sean McGovern > _______________________________________________ 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".