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 2C3DE4737C for ; Tue, 5 Sep 2023 23:41:24 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D163868C7AB; Wed, 6 Sep 2023 02:41:21 +0300 (EEST) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8287668C5B3 for ; Wed, 6 Sep 2023 02:41:14 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 2F3B61C0002 for ; Tue, 5 Sep 2023 23:41:12 +0000 (UTC) Date: Wed, 6 Sep 2023 01:41:12 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20230905234112.GN8640@pb2> References: <20230905020358.32527-1-michael@niedermayer.cc> <20230905020358.32527-2-michael@niedermayer.cc> MIME-Version: 1.0 In-Reply-To: X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH 2/2] avcodec/cbs_h266_syntax_template: Check num_multi_layer_olss 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="===============5774910823170675077==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============5774910823170675077== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="cs5saTBZh7UZl2eX" Content-Disposition: inline --cs5saTBZh7UZl2eX Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 05, 2023 at 10:51:23PM +0800, Nuo Mi wrote: > On Tue, Sep 5, 2023 at 10:04=E2=80=AFAM Michael Niedermayer > wrote: >=20 > > The constraints in the specification are self contradictionary if > > num_multi_layer_olss is 0 > > >=20 > Hi Michael, > See > https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/cbs_h266_syntax_t= emplate.c#L897 > This loop can make sure num_multi_layer_olss > 0. The only exception > is vps_ols_mode_idc =3D=3D 3. > which is reserved by future extension. >=20 > Did you see the "ols_mode_idc =3D=3D 3, patch welcome" output? > Maybe we can return an error at that place. ols_mode_idc and vps_ols_mode_idc are 2 >=20 > That is they require various variables to be positive and smaller than 0.= So > > num_multi_layer_olss cannot be 0 if vps_each_layer_is_an_ols_flag is 0 > > > > Its quite possible a broader check can be used, this is just the first > > condition that I saw violated > > > > Fixes: index 257 out of bounds for type 'uint8_t [257]' > > Fixes: > > 61160/clusterfuzz-testcase-minimized-ffmpeg_BSF_VVC_METADATA_fuzzer-670= 9397181825024 >=20 >=20 > > Found-by: continuous fuzzing process > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > Signed-off-by > > : > > Michael Niedermayer > > --- > > libavcodec/cbs_h266_syntax_template.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/libavcodec/cbs_h266_syntax_template.c > > b/libavcodec/cbs_h266_syntax_template.c > > index 4075897b9a..31b9d0b030 100644 > > --- a/libavcodec/cbs_h266_syntax_template.c > > +++ b/libavcodec/cbs_h266_syntax_template.c > > @@ -944,6 +944,10 @@ static int FUNC(vps) (CodedBitstreamContext *ctx, > > RWContext *rw, > > > > if (!current->vps_each_layer_is_an_ols_flag) { > > uint16_t vps_num_dpb_params; > > + > > + if (num_multi_layer_olss <=3D 0) > > + return AVERROR_INVALIDDATA; > > + > > ue(vps_num_dpb_params_minus1, 0, num_multi_layer_olss - 1); > > if (current->vps_each_layer_is_an_ols_flag) > > vps_num_dpb_params =3D 0; > > -- > > 2.17.1 > > > > _______________________________________________ > > 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". > > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel >=20 > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Into a blind darkness they enter who follow after the Ignorance, they as if into a greater darkness enter who devote themselves to the Knowledge alone. -- Isha Upanishad --cs5saTBZh7UZl2eX Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZPe8kgAKCRBhHseHBAsP qwezAJ9WUkk0DTHKKaQxw5jhofG96UwXgQCeMfJIKvbChPmjvwIyL2DWYQP73qk= =5XlA -----END PGP SIGNATURE----- --cs5saTBZh7UZl2eX-- --===============5774910823170675077== 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". --===============5774910823170675077==--