OSDN Git Service

kmvc: Clip pixel position to valid range
authorLuca Barbato <lu_zero@gentoo.org>
Mon, 1 Jul 2013 01:05:41 +0000 (03:05 +0200)
committerLuca Barbato <lu_zero@gentoo.org>
Sat, 6 Jul 2013 12:12:45 +0000 (14:12 +0200)
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
libavcodec/kmvc.c

index 42a1e01..da181b5 100644 (file)
@@ -30,6 +30,7 @@
 #include "avcodec.h"
 #include "bytestream.h"
 #include "internal.h"
+#include "libavutil/common.h"
 
 #define KMVC_KEYFRAME 0x80
 #define KMVC_PALETTE  0x40
@@ -55,7 +56,7 @@ typedef struct BitBuf {
     int bitbuf;
 } BitBuf;
 
-#define BLK(data, x, y)  data[(x) + (y) * 320]
+#define BLK(data, x, y)  data[av_clip((x) + (y) * 320, 0, 320 * 200 -1)]
 
 #define kmvc_init_getbits(bb, g)  bb.bits = 7; bb.bitbuf = bytestream2_get_byte(g);