Commit a878dfa4 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/ffv1: Initialize vlc_state on allocation

This ensures that they are always set to valid values
Fixes Ticket4939
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent cf52ae00
...@@ -66,7 +66,7 @@ av_cold int ff_ffv1_common_init(AVCodecContext *avctx) ...@@ -66,7 +66,7 @@ av_cold int ff_ffv1_common_init(AVCodecContext *avctx)
av_cold int ff_ffv1_init_slice_state(FFV1Context *f, FFV1Context *fs) av_cold int ff_ffv1_init_slice_state(FFV1Context *f, FFV1Context *fs)
{ {
int j; int j, i;
fs->plane_count = f->plane_count; fs->plane_count = f->plane_count;
fs->transparency = f->transparency; fs->transparency = f->transparency;
...@@ -80,10 +80,15 @@ av_cold int ff_ffv1_init_slice_state(FFV1Context *f, FFV1Context *fs) ...@@ -80,10 +80,15 @@ av_cold int ff_ffv1_init_slice_state(FFV1Context *f, FFV1Context *fs)
if (!p->state) if (!p->state)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} else { } else {
if (!p->vlc_state) if (!p->vlc_state) {
p->vlc_state = av_malloc_array(p->context_count, sizeof(VlcState)); p->vlc_state = av_mallocz_array(p->context_count, sizeof(VlcState));
if (!p->vlc_state) if (!p->vlc_state)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
for (i = 0; i < p->context_count; i++) {
p->vlc_state[i].error_sum = 4;
p->vlc_state[i].count = 1;
}
}
} }
} }
......
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