PR #26269 opened by Baptiste Coudurier (bcoudurier) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26269 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26269.patch
mPrimingFrames and mRemainderFrames are SInt32 in CAF. Values above INT32_MAX made initial_padding negative (e.g. a CBR file with a large packet count and priming 0x80000000 gave initial_padding -2147483648 and skip_samples 2^31); reject them. 🤖 Generated with [Claude Code](https://claude.com/claude-code) From fdf2e55a9ca3d9c83e4e2f6e5d4293822b9d1a4f Mon Sep 17 00:00:00 2001 From: Baptiste Coudurier <[email protected]> Date: Sat, 21 Nov 2026 15:55:40 -0800 Subject: [PATCH] avformat/cafdec: reject out of range priming and remainder frames Both are SInt32; larger values made initial_padding negative. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Baptiste Coudurier <[email protected]> --- libavformat/cafdec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index c296946bba6..19cdb06c02c 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -289,7 +289,9 @@ static int read_pakt_chunk(AVFormatContext *s, int64_t size) st->nb_frames = avio_rb64(pb); /* valid frames */ priming = avio_rb32(pb); /* priming frames */ caf->remainder = avio_rb32(pb); /* remainder frames */ - if (st->nb_frames < 0 || INT64_MAX - priming - caf->remainder < st->nb_frames) + /* both are SInt32 */ + if (priming > INT32_MAX || caf->remainder > INT32_MAX || + st->nb_frames < 0 || INT64_MAX - priming - caf->remainder < st->nb_frames) return AVERROR_INVALIDDATA; caf->frame_cnt = -(int64_t)priming; -- 2.54.1 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
