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 F121744DB7 for ; Tue, 22 Nov 2022 19:22:13 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 046F668BB37; Tue, 22 Nov 2022 21:22:11 +0200 (EET) 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 945F368B081 for ; Tue, 22 Nov 2022 21:22:04 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id B6C891BF207 for ; Tue, 22 Nov 2022 19:22:03 +0000 (UTC) Date: Tue, 22 Nov 2022 20:22:02 +0100 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20221122192202.GF710311@pb2> References: MIME-Version: 1.0 In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH] avcodec/bonk: check level value to not reach invalid values 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="===============6984566474956259923==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============6984566474956259923== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="7cm2iqirTL37Ot+N" Content-Disposition: inline --7cm2iqirTL37Ot+N Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 22, 2022 at 11:26:48AM +0100, Paul B Mahol wrote: > Patch attached. > bonk.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > 84abac919e9c120e48bb1a3f84be0697f620b66a 0001-avcodec-bonk-check-level-v= alue-to-not-reach-invalid-.patch > From 1b9204a39ea111f4fa34fe9cb4254dea2f20923d Mon Sep 17 00:00:00 2001 > From: Paul B Mahol > Date: Tue, 22 Nov 2022 11:27:39 +0100 > Subject: [PATCH] avcodec/bonk: check level value to not reach invalid val= ues >=20 > Signed-off-by: Paul B Mahol > --- > libavcodec/bonk.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) [...] > @@ -330,7 +333,7 @@ static int bonk_decode(AVCodecContext *avctx, AVFrame= *frame, > =20 > skip_bits(gb, s->skip); > if ((ret =3D intlist_read(s, s->k, s->n_taps, 0)) < 0) > - return ret; > + goto fail; > =20 > for (int i =3D 0; i < s->n_taps; i++) > s->k[i] *=3D s->quant[i]; > @@ -345,7 +348,7 @@ static int bonk_decode(AVCodecContext *avctx, AVFrame= *frame, > =20 > predictor_init_state(s->k, state, s->n_taps); > if ((ret =3D intlist_read(s, s->input_samples, samples_per_packe= t, 1)) < 0) > - return ret; > + goto fail; > =20 > for (int i =3D 0; i < samples_per_packet; i++) { > for (int j =3D 0; j < s->down_sampling - 1; j++) { > @@ -390,6 +393,7 @@ static int bonk_decode(AVCodecContext *avctx, AVFrame= *frame, > n =3D get_bits_count(gb) / 8; > =20 > if (n > buf_size) { > +fail: > s->bitstream_size =3D 0; > s->bitstream_index =3D 0; > return AVERROR_INVALIDDATA; > --=20 LGTM thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB When the tyrant has disposed of foreign enemies by conquest or treaty, and there is nothing more to fear from them, then he is always stirring up some war or other, in order that the people may require a leader. -- Plato --7cm2iqirTL37Ot+N Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCY30hUwAKCRBhHseHBAsP qy4nAKCNZ9CKlrW/X+m8TETW3pILSO9g6QCdFHA00gpPMP4rZzaorPx2RbVac1Q= =O4NS -----END PGP SIGNATURE----- --7cm2iqirTL37Ot+N-- --===============6984566474956259923== 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". --===============6984566474956259923==--