summaryrefslogtreecommitdiff
path: root/libavcodec/vp9.c
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2013-12-23 21:40:13 -0500
committerMichael Niedermayer <michaelni@gmx.at>2013-12-24 11:43:53 +0100
commitacafbb4dd26014305bae331d80b9ba7b918d8b8a (patch)
tree14743fe2bd445c03280643f26bdf3bf25c37f08d /libavcodec/vp9.c
parent4a55bffad32e266d96b72b40cf1a7d085e7fce93 (diff)
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>
Diffstat (limited to 'libavcodec/vp9.c')
-rw-r--r--libavcodec/vp9.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index 88c5bc61b0..78b8d2c23b 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -264,7 +264,8 @@ static int vp9_alloc_frame(AVCodecContext *ctx, VP9Frame *f)
f->mv = (struct VP9mvrefPair *) (f->extradata->data + sz);
// 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);
}