avformat/spdif: fix reading past the buffer when probing AAC in IEC 61937

Fixes: read of uninitialized memory
Fixes: 528525234/clusterfuzz-testcase-minimized-ffmpeg_dem_W64_fuzzer-6429204661731328
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
(cherry picked from commit 15bbf3a21d)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer
2026-07-05 03:22:13 +02:00
parent e6bcc30dcd
commit 27f503c90e

View File

@@ -142,7 +142,10 @@ int ff_spdif_probe(const uint8_t *p_buf, int buf_size, enum AVCodecID *codec)
} else
consecutive_codes = 0;
if (buf + 4 + AV_AAC_ADTS_HEADER_SIZE > p_buf + buf_size)
/* spdif_get_offset_and_codec() parses AV_AAC_ADTS_HEADER_SIZE
* bytes starting at buf[5] (the payload after the 4 byte sync and
* the Pc/Pd burst header), so that many bytes must be available. */
if (buf + 5 + AV_AAC_ADTS_HEADER_SIZE > p_buf + buf_size)
break;
/* continue probing to find more sync codes */