]> git.sesse.net Git - ffmpeg/commitdiff
vp8: fix memset() crossing array boundary
authorMans Rullgard <mans@mansr.com>
Fri, 26 Oct 2012 20:43:55 +0000 (21:43 +0100)
committerMans Rullgard <mans@mansr.com>
Sat, 27 Oct 2012 16:02:46 +0000 (17:02 +0100)
Indexing across array boundaries is not allowed by C99.

Signed-off-by: Mans Rullgard <mans@mansr.com>
libavcodec/vp8.c

index 2766c9e37c24e0ce977c7a9d3b445c65b9d5595f..d9902c4c484dd13256cb600ae1001aaeb0063630 100644 (file)
@@ -1964,7 +1964,8 @@ static int vp8_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
     // top edge of 127 for intra prediction
     if (!(avctx->flags & CODEC_FLAG_EMU_EDGE)) {
         s->top_border[0][15] = s->top_border[0][23] = 127;
-        memset(s->top_border[1]-1, 127, s->mb_width*sizeof(*s->top_border)+1);
+        s->top_border[0][31] = 127;
+        memset(s->top_border[1], 127, s->mb_width*sizeof(*s->top_border));
     }
     memset(s->ref_count, 0, sizeof(s->ref_count));