aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author孙浩 and 张洪亮(望初) <tony.sh and wangchu.zhl@alibaba-inc.com>2017-08-25 01:15:29 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-08-28 01:43:03 +0200
commit4c6bed6e3be18f09223e952213b9cb1098ff956f (patch)
tree69457a309171523d85eb7c8194d5ee3bb0f7521a
parent81e6a95e54ff197251570359dbc39b5b779fe972 (diff)
downloadffmpeg-4c6bed6e3be18f09223e952213b9cb1098ff956f.tar.gz
avformat/rl2: Fix DoS due to lack of eof check
Fixes: loop.rl2 Found-by: Xiaohei and Wangchu from Alibaba Security Team Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 96f24d1bee7fe7bac08e2b7c74db1a046c9dc0de) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/rl2.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/libavformat/rl2.c b/libavformat/rl2.c
index 5017016644..dacd65cd84 100644
--- a/libavformat/rl2.c
+++ b/libavformat/rl2.c
@@ -170,12 +170,21 @@ static av_cold int rl2_read_header(AVFormatContext *s)
}
/** read offset and size tables */
- for(i=0; i < frame_count;i++)
+ for(i=0; i < frame_count;i++) {
+ if (avio_feof(pb))
+ return AVERROR_INVALIDDATA;
chunk_size[i] = avio_rl32(pb);
- for(i=0; i < frame_count;i++)
+ }
+ for(i=0; i < frame_count;i++) {
+ if (avio_feof(pb))
+ return AVERROR_INVALIDDATA;
chunk_offset[i] = avio_rl32(pb);
- for(i=0; i < frame_count;i++)
+ }
+ for(i=0; i < frame_count;i++) {
+ if (avio_feof(pb))
+ return AVERROR_INVALIDDATA;
audio_size[i] = avio_rl32(pb) & 0xFFFF;
+ }
/** build the sample index */
for(i=0;i<frame_count;i++){