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 347A948A6A for ; Wed, 26 Jun 2024 18:57:39 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4237168D5F7; Wed, 26 Jun 2024 21:57:37 +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 845FA68BFF8 for ; Wed, 26 Jun 2024 21:57:30 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id E0B021BF204 for ; Wed, 26 Jun 2024 18:57:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1719428250; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=AoUNdnp8w0WWn4nGJAG3KapKtVVPgiYHYHFJ3F9+WZc=; b=mnTSZrwdKh01KA0KTb9yc8j8ccwSJAXNh93DEtH4TjzHZ5tLUpCwxLoyklAZyz2JHI9c6/ LhnSQg5Jm8+HPcP3rD9hv8CAkbDD6rSq0bJZx6tao/d5MHebGw3BIYbAfcOV0Oa5CW/lhd YfcUR1sn1aNh2sn6cWHvXo9ttyDgPCCsJff33cNEyan08Oi0OfJQcFQDSFvL8SXZMubHDK NPj1iRYiceCU7VvhFhFaBhYZTGzrTQxd24zF71PoYANnx6mAcuVLHsVAmehiLp+craRf4f dw/KZhNHDmuPw5IpF6scuw6ALUN4eB2Izp1NQ5aqXUQ3DqVej1irafFjT2RQ8w== Date: Wed, 26 Jun 2024 20:57:28 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20240626185728.GR4991@pb2> References: <20240623230137.1749178-1-michael@niedermayer.cc> <2e1d95e9-b179-412c-ad81-f30bd32fef2a@lynne.ee> <20240625235728.GQ4991@pb2> <2c543b4f-a572-4bde-9981-41fe7a8eb3d5@lynne.ee> MIME-Version: 1.0 In-Reply-To: <2c543b4f-a572-4bde-9981-41fe7a8eb3d5@lynne.ee> X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH 1/5] avcodec/aac/aacdec_usac: Test ac in usac 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="===============4616462271165410028==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============4616462271165410028== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Dx1O6sYEs5STvSrm" Content-Disposition: inline --Dx1O6sYEs5STvSrm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jun 26, 2024 at 08:58:27AM +0200, Lynne via ffmpeg-devel wrote: > On 26/06/2024 01:57, Michael Niedermayer wrote: > > On Wed, Jun 26, 2024 at 01:35:18AM +0200, Lynne via ffmpeg-devel wrote: > > > On 24/06/2024 01:01, Michael Niedermayer wrote: > > > > ff_aac_usac_config_decode() needs AACDecContext to be set but some = callers > > > > pass NULL. > > > >=20 > > > > I have no real testcase to implement/test this, so failing in this = case > > > > seems safest. > > > >=20 > > > > Fixes: member access within null pointer of type 'AACDecContext' (a= ka 'struct AACDecContext') > > > > Fixes: 69435/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_= LATM_fuzzer-5733527483121664 > > > >=20 > > > > Found-by: continuous fuzzing process https://github.com/google/oss-= fuzz/tree/master/projects/ffmpeg > > > > Signed-off-by: Michael Niedermayer > > > > --- > > > > libavcodec/aac/aacdec_usac.c | 3 +++ > > > > 1 file changed, 3 insertions(+) > > > >=20 > > > > diff --git a/libavcodec/aac/aacdec_usac.c b/libavcodec/aac/aacdec_u= sac.c > > > > index 132ffee9c20..4856c1786b7 100644 > > > > --- a/libavcodec/aac/aacdec_usac.c > > > > +++ b/libavcodec/aac/aacdec_usac.c > > > > @@ -348,6 +348,9 @@ int ff_aac_usac_config_decode(AACDecContext *ac= , AVCodecContext *avctx, > > > > int map_pos_set =3D 0; > > > > uint8_t layout_map[MAX_ELEM_ID*4][3] =3D { 0 }; > > > > + if (!ac) > > > > + return AVERROR_PATCHWELCOME; > > > > + > > > > memset(usac, 0, sizeof(*usac)); > > > > freq_idx =3D get_bits(gb, 5); /* usacSamplingFrequencyIndex = */ > > >=20 > > > This doesn't seem possible at all. > > > There are 2 callers, parse_audio_preroll and > > > decode_audio_specific_config_gb. Both of these will crash way before = the > > > function is called. > > >=20 > > > Could you at least get a backtrace? > >=20 > > sure > >=20 > > libavcodec/aac/aacdec_usac.c:402:39: runtime error: member access withi= n null pointer of type 'AACDecContext' (aka 'struct AACDecContext') > > SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior libavcodec/aac/= aacdec_usac.c:402:39 in > > AddressSanitizer:DEADLYSIGNAL > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > =3D=3D215602=3D=3DERROR: AddressSanitizer: SEGV on unknown address 0x00= 0000005b10 (pc 0x00000154771e bp 0x7ffcf5049e90 sp 0x7ffcf5049e70 T0) > > =3D=3D215602=3D=3DThe signal is caused by a READ memory access. > > #0 0x154771d in av_channel_layout_uninit ffmpeg/libavutil/channel_= layout.c:439:25 > > #1 0x57346e in ff_aac_usac_config_decode ffmpeg/libavcodec/aac/aac= dec_usac.c:402:9 > > #2 0x500a0a in decode_audio_specific_config_gb ffmpeg/libavcodec/a= ac/aacdec.c:1050:20 > > #3 0x50a542 in latm_decode_audio_specific_config ffmpeg/libavcodec= /aac/aacdec_latm.h:80:21 > > #4 0x4f8638 in read_stream_mux_config ffmpeg/libavcodec/aac/aacdec= _latm.h:160:24 > > #5 0x4f8638 in read_audio_mux_element ffmpeg/libavcodec/aac/aacdec= _latm.h:233 > > #6 0x4f8638 in latm_decode_frame ffmpeg/libavcodec/aac/aacdec_latm= =2Eh:275 > > #7 0x68f26f in decode_simple_internal ffmpeg/libavcodec/decode.c:4= 29:20 > > #8 0x68f26f in decode_simple_receive_frame ffmpeg/libavcodec/decod= e.c:600 > > #9 0x68f26f in decode_receive_frame_internal ffmpeg/libavcodec/dec= ode.c:631 > > #10 0x68dc9d in avcodec_send_packet ffmpeg/libavcodec/decode.c:721= :15 > > #11 0x4d1e55 in LLVMFuzzerTestOneInput ffmpeg/tools/target_dec_fuz= zer.c:534:25 > >=20 > >=20 > > [...] > >=20 > >=20 > >=20 > > _______________________________________________ > > 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 > This patch actually is correct. > USAC in LATM is not supported AFAIK. >=20 > LGTM with a note like: > "Happens only when the LATM decoder is used, and USAC is not supported in > LATM". will apply with this thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB There will always be a question for which you do not know the correct answe= r. --Dx1O6sYEs5STvSrm Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZnxkkAAKCRBhHseHBAsP q/RlAJ95DCFGEGaph8F9bHxMbgQr0dsxYwCfYWyDo8L1+jpBU4/MPY31WheasRY= =tG/v -----END PGP SIGNATURE----- --Dx1O6sYEs5STvSrm-- --===============4616462271165410028== 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". --===============4616462271165410028==--