Commit dabea74d authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/vp8: Do not use num_coeff_partitions in thread/buffer setup

The variable is not a constant and can lead to race conditions

Fixes: repro.webm (not reproducable with FFmpeg alone)
Found-by: 's avatarDale Curtis <dalecurtis@google.com>
Tested-by: 's avatarDale Curtis <dalecurtis@google.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 30ce6fd1
...@@ -164,7 +164,7 @@ int update_dimensions(VP8Context *s, int width, int height, int is_vp7) ...@@ -164,7 +164,7 @@ int update_dimensions(VP8Context *s, int width, int height, int is_vp7)
s->mb_height = (s->avctx->coded_height + 15) / 16; s->mb_height = (s->avctx->coded_height + 15) / 16;
s->mb_layout = is_vp7 || avctx->active_thread_type == FF_THREAD_SLICE && s->mb_layout = is_vp7 || avctx->active_thread_type == FF_THREAD_SLICE &&
FFMIN(s->num_coeff_partitions, avctx->thread_count) > 1; avctx->thread_count > 1;
if (!s->mb_layout) { // Frame threading and one thread if (!s->mb_layout) { // Frame threading and one thread
s->macroblocks_base = av_mallocz((s->mb_width + s->mb_height * 2 + 1) * s->macroblocks_base = av_mallocz((s->mb_width + s->mb_height * 2 + 1) *
sizeof(*s->macroblocks)); sizeof(*s->macroblocks));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment