aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2013-07-01 03:05:41 +0200
committerLuca Barbato <lu_zero@gentoo.org>2013-07-06 14:12:45 +0200
commit4e7f0b082d8c4b360312216b9241bec65ff63b35 (patch)
tree63d9578e62a22a9bf53c0390fb03a8301f0d8b8b
parent8f689770548c86151071ef976cf9b6998ba21c2a (diff)
downloadffmpeg-4e7f0b082d8c4b360312216b9241bec65ff63b35.tar.gz
kmvc: Clip pixel position to valid range
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org
-rw-r--r--libavcodec/kmvc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/kmvc.c b/libavcodec/kmvc.c
index 42a1e01c84..da181b5226 100644
--- a/libavcodec/kmvc.c
+++ b/libavcodec/kmvc.c
@@ -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);