blob: 886012503000822ff706bb43952542329572ea4c [file] [log] [blame]
Brad Bishopd7bf8c12018-02-25 22:55:05 -05001From 900f39692ca0337a98a7cf047e4e2611071810c2 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?=E5=AD=99=E6=B5=A9=28=E6=99=93=E9=BB=91=29?=
3 <tony.sh@alibaba-inc.com>
4Date: Tue, 29 Aug 2017 23:59:21 +0200
5Subject: [PATCH] avformat/mxfdec: Fix DoS issues in
6 mxf_read_index_entry_array()
7MIME-Version: 1.0
8Content-Type: text/plain; charset=UTF-8
9Content-Transfer-Encoding: 8bit
10
11Fixes: 20170829A.mxf
12
13Co-Author: 张洪亮(望初)" <wangchu.zhl@alibaba-inc.com>
14Found-by: Xiaohei and Wangchu from Alibaba Security Team
15Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
16
17CVE: CVE-2017-14170
18Upstream-Status: Backport
19
20Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
21---
22 libavformat/mxfdec.c | 4 ++++
23 1 file changed, 4 insertions(+)
24
25diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
26index 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--
482.1.0
49