blob: 886012503000822ff706bb43952542329572ea4c [file] [log] [blame]
From 900f39692ca0337a98a7cf047e4e2611071810c2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AD=99=E6=B5=A9=28=E6=99=93=E9=BB=91=29?=
<tony.sh@alibaba-inc.com>
Date: Tue, 29 Aug 2017 23:59:21 +0200
Subject: [PATCH] avformat/mxfdec: Fix DoS issues in
mxf_read_index_entry_array()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Fixes: 20170829A.mxf
Co-Author: 张洪亮(望初)" <wangchu.zhl@alibaba-inc.com>
Found-by: Xiaohei and Wangchu from Alibaba Security Team
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
CVE: CVE-2017-14170
Upstream-Status: Backport
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
libavformat/mxfdec.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index f8d0f9e..6adb77d 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -899,6 +899,8 @@ static int mxf_read_index_entry_array(AVIOContext *pb, MXFIndexTableSegment *seg
segment->nb_index_entries = avio_rb32(pb);
length = avio_rb32(pb);
+ if(segment->nb_index_entries && length < 11)
+ return AVERROR_INVALIDDATA;
if (!(segment->temporal_offset_entries=av_calloc(segment->nb_index_entries, sizeof(*segment->temporal_offset_entries))) ||
!(segment->flag_entries = av_calloc(segment->nb_index_entries, sizeof(*segment->flag_entries))) ||
@@ -909,6 +911,8 @@ static int mxf_read_index_entry_array(AVIOContext *pb, MXFIndexTableSegment *seg
}
for (i = 0; i < segment->nb_index_entries; i++) {
+ if(avio_feof(pb))
+ return AVERROR_INVALIDDATA;
segment->temporal_offset_entries[i] = avio_r8(pb);
avio_r8(pb); /* KeyFrameOffset */
segment->flag_entries[i] = avio_r8(pb);
--
2.1.0