aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-11-24 22:12:37 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2015-12-14 16:51:00 +0100
commit54e94522b899111dd4b9f93386d582d26859ead5 (patch)
tree6c9bb367728bc06a5e75048409ef210e7b4dcd98
parent8405b6329463af8ac2e5dac4fcdda03888388f78 (diff)
downloadffmpeg-54e94522b899111dd4b9f93386d582d26859ead5.tar.gz
avcodec/h264_slice: Limit max_contexts when slice_context_count is initialized
Fixes out of array access Fixes: 1430e9c43fae47a24c179c7c54f94918/signal_sigsegv_421427_2049_f2192b6829ab6e0eefcb035329c03c60.264 Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 4ea4d2f438c9a7eba37980c9a87be4b34943e4d5) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/h264_slice.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 10f4d77380..9cbe8d2966 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1086,6 +1086,7 @@ static int h264_slice_header_init(H264Context *h)
nb_slices = max_slices;
}
h->slice_context_count = nb_slices;
+ h->max_contexts = FFMIN(h->max_contexts, nb_slices);
if (!HAVE_THREADS || !(h->avctx->active_thread_type & FF_THREAD_SLICE)) {
ret = ff_h264_slice_context_init(h, &h->slice_ctx[0]);