Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 1 | From 124eb202e70678539544f6268efc98131f19fa49 Mon Sep 17 00:00:00 2001 |
| 2 | From: =?UTF-8?q?=E5=AD=99=E6=B5=A9=20and=20=E5=BC=A0=E6=B4=AA=E4=BA=AE=28?= |
| 3 | =?UTF-8?q?=E6=9C=9B=E5=88=9D=29?= <tony.sh and wangchu.zhl@alibaba-inc.com> |
| 4 | Date: Fri, 25 Aug 2017 01:15:28 +0200 |
| 5 | Subject: [PATCH] avformat/rmdec: Fix DoS due to lack of eof check |
| 6 | |
| 7 | Fixes: loop.ivr |
| 8 | |
| 9 | Found-by: Xiaohei and Wangchu from Alibaba Security Team |
| 10 | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> |
| 11 | |
| 12 | CVE: CVE-2017-14054 |
| 13 | Upstream-Status: Backport |
| 14 | |
| 15 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> |
| 16 | --- |
| 17 | libavformat/rmdec.c | 5 ++++- |
| 18 | 1 file changed, 4 insertions(+), 1 deletion(-) |
| 19 | |
| 20 | diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c |
| 21 | index 178eaea..d6d7d9c 100644 |
| 22 | --- a/libavformat/rmdec.c |
| 23 | +++ b/libavformat/rmdec.c |
| 24 | @@ -1223,8 +1223,11 @@ static int ivr_read_header(AVFormatContext *s) |
| 25 | av_log(s, AV_LOG_DEBUG, "%s = '%s'\n", key, val); |
| 26 | } else if (type == 4) { |
| 27 | av_log(s, AV_LOG_DEBUG, "%s = '0x", key); |
| 28 | - for (j = 0; j < len; j++) |
| 29 | + for (j = 0; j < len; j++) { |
| 30 | + if (avio_feof(pb)) |
| 31 | + return AVERROR_INVALIDDATA; |
| 32 | av_log(s, AV_LOG_DEBUG, "%X", avio_r8(pb)); |
| 33 | + } |
| 34 | av_log(s, AV_LOG_DEBUG, "'\n"); |
| 35 | } else if (len == 4 && type == 3 && !strncmp(key, "StreamCount", tlen)) { |
| 36 | nb_streams = value = avio_rb32(pb); |
| 37 | -- |
| 38 | 2.1.0 |
| 39 | |