File 0001-avcodec-ansi-Check-dimensions.patch of Package ffmpeg2
From ab737ab31d4f126ed5a13a6a0498824141925108 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <michael@niedermayer.cc>
Date: Mon, 26 Sep 2016 20:25:59 +0200
Subject: [PATCH] avcodec/ansi: Check dimensions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Fixes: 1.avi
Found-by: 连一汉 <lianyihan@360.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 69449da436169e7facaa6d1f3bcbc41cf6ce2754)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavcodec/ansi.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libavcodec/ansi.c b/libavcodec/ansi.c
index 21d5ae1..98ea9e3 100644
--- a/libavcodec/ansi.c
+++ b/libavcodec/ansi.c
@@ -94,6 +94,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
int ret = ff_set_dimensions(avctx, 80 << 3, 25 << 4);
if (ret < 0)
return ret;
+ } else if (avctx->width % FONT_WIDTH || avctx->height % s->font_height) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid dimensions %d %d\n", avctx->width, avctx->height);
+ return AVERROR(EINVAL);
}
return 0;
}
--
2.6.6