aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-11-28 10:54:35 +0100
committerSean McGovern <gseanmcg@gmail.com>2014-04-14 16:55:38 -0400
commit7e513d85e80d730718695d09fcaf0295ae24699e (patch)
treeb7ba6c892343447db522c8447f556798bf8d6e6c
parentb6a0f5cde808d84626f07b11c381cc6ef0954940 (diff)
downloadffmpeg-7e513d85e80d730718695d09fcaf0295ae24699e.tar.gz
h264: check that execute_decode_slices() is not called too many times
Fixes invalid reads. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC:libav-stable@libav.org (cherry picked from commit 9eef9eb3014b2ed9c3ff4aac510a9f04edb555cf)
-rw-r--r--libavcodec/h264.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 7acc5a7019..b5f4493c57 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -3833,6 +3833,12 @@ static int execute_decode_slices(H264Context *h, int context_count)
H264Context *hx;
int i;
+ if (s->mb_y >= s->mb_height) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Input contains more MB rows than the frame height.\n");
+ return AVERROR_INVALIDDATA;
+ }
+
if (s->avctx->hwaccel ||
s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
return 0;