From 8db9d9963446067e167a66883753e4e411fe61df Mon Sep 17 00:00:00 2001 From: tabudz Date: Sun, 8 Mar 2026 23:08:55 +0800 Subject: [PATCH] avformat/rmdec: Fix DoS due to lack of eof check Fixes: loop.ivr Found-by: Xiaohei and Wangchu from Alibaba Security Team Signed-off-by: Michael Niedermayer --- 3rdparty/ffmpeg/libavformat/rmdec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/3rdparty/ffmpeg/libavformat/rmdec.c b/3rdparty/ffmpeg/libavformat/rmdec.c index 1a61b10d..fa659987 100644 --- a/3rdparty/ffmpeg/libavformat/rmdec.c +++ b/3rdparty/ffmpeg/libavformat/rmdec.c @@ -1231,8 +1231,11 @@ static int ivr_read_header(AVFormatContext *s) av_log(s, AV_LOG_DEBUG, "%s = '%s'\n", key, val); } else if (type == 4) { av_log(s, AV_LOG_DEBUG, "%s = '0x", key); - for (j = 0; j < len; j++) + for (j = 0; j < len; j++) { + if (avio_feof(pb)) + return AVERROR_INVALIDDATA; av_log(s, AV_LOG_DEBUG, "%X", avio_r8(pb)); + } av_log(s, AV_LOG_DEBUG, "'\n"); } else if (len == 4 && type == 3 && !strncmp(key, "StreamCount", tlen)) { nb_streams = value = avio_rb32(pb);