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 2A47D47190 for ; Sat, 12 Aug 2023 18:39:49 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AFFB368C39F; Sat, 12 Aug 2023 21:39:46 +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 6646268C14C for ; Sat, 12 Aug 2023 21:39:40 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id B458B60004 for ; Sat, 12 Aug 2023 18:39:39 +0000 (UTC) Date: Sat, 12 Aug 2023 20:39:38 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20230812183938.GM7802@pb2> References: <20230810234856.2636-1-pal@sandflow.com> MIME-Version: 1.0 In-Reply-To: <20230810234856.2636-1-pal@sandflow.com> X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH v1] avcodec/jpeg2000htdec: check if block decoding will exceed internal precision 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="===============6504638554117712422==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============6504638554117712422== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6RSemckJUp/nCuHD" Content-Disposition: inline --6RSemckJUp/nCuHD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Aug 10, 2023 at 04:48:56PM -0700, pal@sandflow.com wrote: > From: Pierre-Anthony Lemieux >=20 > Intended to replace https://patchwork.ffmpeg.org/project/ffmpeg/patch/202= 30802000135.26482-3-michael@niedermayer.cc/ > with a more accurate block decoding magnitude bound. >=20 > --- > libavcodec/jpeg2000htdec.c | 32 +++++++++++++++++++++++++++++++- > 1 file changed, 31 insertions(+), 1 deletion(-) >=20 > diff --git a/libavcodec/jpeg2000htdec.c b/libavcodec/jpeg2000htdec.c > index 2c4cea5dd9..713dba17e3 100644 > --- a/libavcodec/jpeg2000htdec.c > +++ b/libavcodec/jpeg2000htdec.c > @@ -572,6 +572,14 @@ static int jpeg2000_decode_ht_cleanup_segment(const = Jpeg2000DecoderContext *s, > =20 > const uint8_t *vlc_buf =3D Dcup + Pcup; > =20 > + /* > + * Bound on the recision needed to process the codeblock. The number= of > + * decoded bit planes is equal to at most cblk->zbp + 2 since S_blk = =3D P if > + * there are no placeholder passes or HT Sets and P =3D cblk->zbp. S= ee Rec. > + * ITU-T T.814, 7.6. > + */ > + int maxbp =3D cblk->zbp + 2; > + > /* convert to raster-scan */ > const uint16_t is_border_x =3D width % 2; > const uint16_t is_border_y =3D height % 2; > @@ -590,6 +598,10 @@ static int jpeg2000_decode_ht_cleanup_segment(const = Jpeg2000DecoderContext *s, > goto free; > } > =20 > + /* do we have enough precision, assuming a 32-bit decoding path */ > + if (maxbp >=3D 32) > + return AVERROR_INVALIDDATA; doesnt this need a goto free ? thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB No human being will ever know the Truth, for even if they happen to say it by chance, they would not even known they had done so. -- Xenophanes --6RSemckJUp/nCuHD Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZNfR5AAKCRBhHseHBAsP q9HuAJ90SiSy59+mlCxiwuXcay437OB0TACfR1mynq7os0yXCzmB8iR1xMLz/nU= =zLgu -----END PGP SIGNATURE----- --6RSemckJUp/nCuHD-- --===============6504638554117712422== 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". --===============6504638554117712422==--