PR #21176 opened by Jack Lau (JackLau) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21176 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21176.patch
Fix #21056 Refer to RFC 3267 Section 4.4.2: A ToC entry takes the following format in octet-aligned mode: 0 1 2 3 4 5 6 7 +-+-+-+-+-+-+-+-+ |F| FT |Q|P|P| +-+-+-+-+-+-+-+-+ P bits: padding bits, MUST be set to zero. Signed-off-by: Jack Lau <[email protected]> >From 95a39927b24e649019fdaf640dc7dd45ea1161e9 Mon Sep 17 00:00:00 2001 From: Jack Lau <[email protected]> Date: Fri, 12 Dec 2025 14:52:58 +0800 Subject: [PATCH] avformat/amr: add P bits check to avoid mis-detects Fix #21056 Refer to RFC 3267 Section 4.4.2: A ToC entry takes the following format in octet-aligned mode: 0 1 2 3 4 5 6 7 +-+-+-+-+-+-+-+-+ |F| FT |Q|P|P| +-+-+-+-+-+-+-+-+ P bits: padding bits, MUST be set to zero. Signed-off-by: Jack Lau <[email protected]> --- libavformat/amr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/amr.c b/libavformat/amr.c index 0db0a8d26a..9cc61baf55 100644 --- a/libavformat/amr.c +++ b/libavformat/amr.c @@ -144,7 +144,7 @@ static int amrnb_probe(const AVProbeData *p) while (i < p->buf_size) { mode = b[i] >> 3 & 0x0F; - if (mode < 9 && (b[i] & 0x4) == 0x4) { + if (mode < 9 && (b[i] & 0x4) == 0x4 && (b[i] & 0x03) == 0) { int last = b[i]; int size = amrnb_packed_size[mode]; while (size--) { @@ -201,7 +201,7 @@ static int amrwb_probe(const AVProbeData *p) while (i < p->buf_size) { mode = b[i] >> 3 & 0x0F; - if (mode < 10 && (b[i] & 0x4) == 0x4) { + if (mode < 10 && (b[i] & 0x4) == 0x4 && (b[i] & 0x03) == 0) { int last = b[i]; int size = amrwb_packed_size[mode]; while (size--) { -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
