[FFmpeg-cvslog] avformat/rmdec: Fix DoS due to lack of eof check

孙浩 and 张洪亮(望初) git at videolan.org
Sun Sep 17 17:51:53 EEST 2017


ffmpeg | branch: release/3.1 | 孙浩 and 张洪亮(望初) <tony.sh and wangchu.zhl at alibaba-inc.com> | Fri Aug 25 01:15:28 2017 +0200| [770482def3b3064e236f9a0e1b6f5d0ca35ae7e2] | committer: Michael Niedermayer

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 <michael at niedermayer.cc>
(cherry picked from commit 124eb202e70678539544f6268efc98131f19fa49)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=770482def3b3064e236f9a0e1b6f5d0ca35ae7e2
---

 libavformat/rmdec.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index 0809b0b251..c4f3e59676 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -1235,8 +1235,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);



More information about the ffmpeg-cvslog mailing list