aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/ffv1enc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-09-24 23:49:30 +0200
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2015-10-10 01:12:18 +0200
commitb44025a1d031fc000dcd984364775fd8014717ba (patch)
tree6da0d45d8c996a5678bde03deb29b548c5a85ee0 /libavcodec/ffv1enc.c
parent7fc8458bebc65544dccc181a20af28cfe285fcd0 (diff)
downloadffmpeg-b44025a1d031fc000dcd984364775fd8014717ba.tar.gz
avcodec/ffv1: seperate slice_count from max_slice_count
Fix segfault with too large slice_count Fixes Ticket4879 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit aa6c43f3fdec8a7518534b9dab20c9eb4be11568) Conflicts: libavcodec/ffv1enc.c libavcodec/ffv1.c
Diffstat (limited to 'libavcodec/ffv1enc.c')
-rw-r--r--libavcodec/ffv1enc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index 78143a0604..f34e3b89ef 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -902,6 +902,7 @@ slices_ok:
if ((ret = ffv1_init_slice_contexts(s)) < 0)
return ret;
+ s->slice_count = s->max_slice_count;
if ((ret = ffv1_init_slices_state(s)) < 0)
return ret;
@@ -911,7 +912,7 @@ slices_ok:
if (!avctx->stats_out)
return AVERROR(ENOMEM);
for (i = 0; i < s->quant_table_count; i++)
- for (j = 0; j < s->slice_count; j++) {
+ for (j = 0; j < s->max_slice_count; j++) {
FFV1Context *sf = s->slice_context[j];
av_assert0(!sf->rc_stat2[i]);
sf->rc_stat2[i] = av_mallocz(s->context_count[i] *