Browse code

kmvc: Clip pixel position to valid range

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 4e7f0b082d8c4b360312216b9241bec65ff63b35)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
libavcodec/kmvc.c

Luca Barbato authored on 2013/07/01 10:05:41
Showing 1 changed files
... ...
@@ -29,6 +29,8 @@
29 29
 
30 30
 #include "avcodec.h"
31 31
 #include "bytestream.h"
32
+#include "internal.h"
33
+#include "libavutil/common.h"
32 34
 
33 35
 #define KMVC_KEYFRAME 0x80
34 36
 #define KMVC_PALETTE  0x40
... ...
@@ -55,7 +57,7 @@ typedef struct BitBuf {
55 55
     int bitbuf;
56 56
 } BitBuf;
57 57
 
58
-#define BLK(data, x, y)  data[(x) + (y) * 320]
58
+#define BLK(data, x, y)  data[av_clip((x) + (y) * 320, 0, 320 * 200 -1)]
59 59
 
60 60
 #define kmvc_init_getbits(bb, g)  bb.bits = 7; bb.bitbuf = bytestream2_get_byte(g);
61 61