1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

vp9: fix crash if segmentation=1, keyframe/intraonly=1 and updatemap=0.

The reference map is never used in such cases, but we accidently copied
it anyway. This could cause crashes if this map has not yet been
allocated. Fixes trac ticket 3188.

Reviewed-by: Clément Bœsch <u@pkh.me>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Ronald S. Bultje 2013-12-23 21:40:13 -05:00 committed by Michael Niedermayer
parent 4a55bffad3
commit acafbb4dd2

View File

@ -264,7 +264,8 @@ static int vp9_alloc_frame(AVCodecContext *ctx, VP9Frame *f)
f->mv = (struct VP9mvrefPair *) (f->extradata->data + sz); f->mv = (struct VP9mvrefPair *) (f->extradata->data + sz);
// retain segmentation map if it doesn't update // retain segmentation map if it doesn't update
if (s->segmentation.enabled && !s->segmentation.update_map) { if (s->segmentation.enabled && !s->segmentation.update_map &&
!s->keyframe && !s->intraonly) {
memcpy(f->segmentation_map, s->frames[LAST_FRAME].segmentation_map, sz); memcpy(f->segmentation_map, s->frames[LAST_FRAME].segmentation_map, sz);
} }