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 27A3E45CEA for ; Mon, 3 Apr 2023 14:27:41 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 22D4668BE80; Mon, 3 Apr 2023 17:27:39 +0300 (EEST) Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9535568BE67 for ; Mon, 3 Apr 2023 17:27:32 +0300 (EEST) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id A46841BF217 for ; Mon, 3 Apr 2023 14:27:31 +0000 (UTC) Date: Mon, 3 Apr 2023 16:27:30 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20230403142730.GS1164690@pb2> References: <20230331152941.21879-1-pal@sandflow.com> <20230331152941.21879-2-pal@sandflow.com> <20230402221743.GQ1164690@pb2> MIME-Version: 1.0 In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH v1 2/3] avcodec/jpeg2000dec: add support for HTJ2K block decoding 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="===============1289322577425362191==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============1289322577425362191== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="4ZVTVymsHR1TEBjP" Content-Disposition: inline --4ZVTVymsHR1TEBjP Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Apr 02, 2023 at 03:21:08PM -0700, Pierre-Anthony Lemieux wrote: > On Sun, Apr 2, 2023 at 3:17=E2=80=AFPM Michael Niedermayer > wrote: > > > > On Fri, Mar 31, 2023 at 08:29:40AM -0700, pal@sandflow.com wrote: > > > From: caleb [...] > > [...] > > > +/** > > > + * Drops bits from lower bits in the bit buffer. buf contains the bi= t buffers. > > > + * nbits is the number of bits to remove. > > > + */ > > > +av_always_inline > > > +static void jpeg2000_bitbuf_drop_bits_lsb(StateVars *buf, uint8_t nb= its) > > > +{ > > > + if (buf->bits_left < nbits) { > > > > > + av_log(NULL, AV_LOG_ERROR, "Invalid bit read of %d, bits in = buffer are %d\n", nbits, buf->bits_left); > > > + av_assert0(0); > > > > > > [...] > > > +int > > > +ff_jpeg2000_decode_htj2k(const Jpeg2000DecoderContext *s, Jpeg2000Co= dingStyle *codsty, Jpeg2000T1Context *t1, Jpeg2000Cblk *cblk, > > > + int width, int height, int magp, uint8_t ro= i_shift) > > > +{ > > > + uint8_t p0 =3D 0; // Number of placeholder passes > > > + uint32_t Lcup; // Length of HT cleanup segment > > > + uint32_t Lref; // Length of Refinement segment > > > + uint32_t Scup; // HT cleanup segment suffix length > > > + uint32_t Pcup; // HT cleanup segment prefix length > > > + > > > + uint8_t S_blk; // Number of skipped magnitude bitpl= anes > > > + uint8_t pLSB; > > > + > > > + uint8_t *Dcup; // Byte of an HT cleanup segment > > > + uint8_t *Dref; // Byte of an HT refinement segment > > > + > > > + int z_blk; // Number of ht coding pass > > > + > > > + uint8_t empty_passes; > > > + > > > + StateVars mag_sgn; // Magnitude and Sign > > > + StateVars mel; // Adaptive run-length coding > > > + StateVars vlc; // Variable Length coding > > > + StateVars sig_prop; // Significance propagation > > > + > > > + MelDecoderState mel_state; > > > + > > > + int ret; > > > + > > > + /* Temporary buffers */ > > > + int32_t *sample_buf; > > > + uint8_t *block_states; > > > + > > > + int32_t n, val; // Post-processing > > > + > > > + int32_t M_b =3D magp; > > > + av_assert0(width <=3D 1024U && height <=3D 1024U); > > > + av_assert0(width * height <=3D 4096); > > > + av_assert0(width * height > 0); > > > > Has this decoder been tested with some fuzzer ? >=20 > Yes. ok >=20 > > I see a bunch of asserts in it and i dont immedeatly see what would pre= vent them from > > triggering maybe you can add comments to the asserts that explain why these are guranteed to be true thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Modern terrorism, a quick summary: Need oil, start war with country that has oil, kill hundread thousand in war. Let country fall into chaos, be surprised about raise of fundamantalists. Drop more bombs, kill more people, be surprised about them taking revenge and drop even more bombs and strip your own citizens of their rights and freedoms. to be continued --4ZVTVymsHR1TEBjP Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZCriTQAKCRBhHseHBAsP q3HTAKCDq/+S6SFWAQevKGbKniLkw+l2+QCghqx5zzvMoathslLzkOT55fIs6Qw= =NSQI -----END PGP SIGNATURE----- --4ZVTVymsHR1TEBjP-- --===============1289322577425362191== 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". --===============1289322577425362191==--