From 696ea1c2236842572df88d573e24a39be3f19c98 Mon Sep 17 00:00:00 2001 From: Dale Curtis Date: Mon, 24 Feb 2025 16:52:10 -0800 Subject: [PATCH] Don't attempt to parse ADTS from USAC packets. It's not possible to put USAC into ADTS due to exceeding the field size (4 bits) for ADTS profile. As such cases where the frame starts with 0xfff shouldn't be checked. This ensures the sample at https://crbug.com/396190942 is properly detected as USAC content. Signed-off-by: Dale Curtis --- libavcodec/aac/aacdec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/aac/aacdec.c b/libavcodec/aac/aacdec.c index 8d50ad6d09..22c70da27f 100644 --- a/libavcodec/aac/aacdec.c +++ b/libavcodec/aac/aacdec.c @@ -2391,7 +2391,8 @@ static int aac_decode_frame_int(AVCodecContext *avctx, AVFrame *frame, ac->frame = frame; *got_frame_ptr = 0; - if (show_bits(gb, 12) == 0xfff) { + // USAC can't be packed into ADTS due to field size limitations. + if (show_bits(gb, 12) == 0xfff && ac->oc[1].m4ac.object_type != AOT_USAC) { if ((err = parse_adts_frame_header(ac, gb)) < 0) { av_log(avctx, AV_LOG_ERROR, "Error decoding AAC frame header.\n"); goto fail;