Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 1 | From 900f39692ca0337a98a7cf047e4e2611071810c2 Mon Sep 17 00:00:00 2001 |
| 2 | From: =?UTF-8?q?=E5=AD=99=E6=B5=A9=28=E6=99=93=E9=BB=91=29?= |
| 3 | <tony.sh@alibaba-inc.com> |
| 4 | Date: Tue, 29 Aug 2017 23:59:21 +0200 |
| 5 | Subject: [PATCH] avformat/mxfdec: Fix DoS issues in |
| 6 | mxf_read_index_entry_array() |
| 7 | MIME-Version: 1.0 |
| 8 | Content-Type: text/plain; charset=UTF-8 |
| 9 | Content-Transfer-Encoding: 8bit |
| 10 | |
| 11 | Fixes: 20170829A.mxf |
| 12 | |
| 13 | Co-Author: 张洪亮(望初)" <wangchu.zhl@alibaba-inc.com> |
| 14 | Found-by: Xiaohei and Wangchu from Alibaba Security Team |
| 15 | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> |
| 16 | |
| 17 | CVE: CVE-2017-14170 |
| 18 | Upstream-Status: Backport |
| 19 | |
| 20 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> |
| 21 | --- |
| 22 | libavformat/mxfdec.c | 4 ++++ |
| 23 | 1 file changed, 4 insertions(+) |
| 24 | |
| 25 | diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c |
| 26 | index f8d0f9e..6adb77d 100644 |
| 27 | --- a/libavformat/mxfdec.c |
| 28 | +++ b/libavformat/mxfdec.c |
| 29 | @@ -899,6 +899,8 @@ static int mxf_read_index_entry_array(AVIOContext *pb, MXFIndexTableSegment *seg |
| 30 | segment->nb_index_entries = avio_rb32(pb); |
| 31 | |
| 32 | length = avio_rb32(pb); |
| 33 | + if(segment->nb_index_entries && length < 11) |
| 34 | + return AVERROR_INVALIDDATA; |
| 35 | |
| 36 | if (!(segment->temporal_offset_entries=av_calloc(segment->nb_index_entries, sizeof(*segment->temporal_offset_entries))) || |
| 37 | !(segment->flag_entries = av_calloc(segment->nb_index_entries, sizeof(*segment->flag_entries))) || |
| 38 | @@ -909,6 +911,8 @@ static int mxf_read_index_entry_array(AVIOContext *pb, MXFIndexTableSegment *seg |
| 39 | } |
| 40 | |
| 41 | for (i = 0; i < segment->nb_index_entries; i++) { |
| 42 | + if(avio_feof(pb)) |
| 43 | + return AVERROR_INVALIDDATA; |
| 44 | segment->temporal_offset_entries[i] = avio_r8(pb); |
| 45 | avio_r8(pb); /* KeyFrameOffset */ |
| 46 | segment->flag_entries[i] = avio_r8(pb); |
| 47 | -- |
| 48 | 2.1.0 |
| 49 | |