summaryrefslogtreecommitdiff
path: root/libavcodec/indeo3.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2011-05-17 22:21:33 +0200
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2011-05-25 11:29:47 +0200
commit48df6a241532f0702fc4fd10ddcbfac435e4027c (patch)
tree6b63dc5f6d2548befc168c9c831f75302c43e4f5 /libavcodec/indeo3.c
parent39d983461a81766f06bf66c0be254f5bdd7b8eb5 (diff)
indeo3: add out-of-buffer write check
Prevent out-of-buffer writes. In particular fix smclocki32.avi.1.1 crash, trac issue #114, roundup issue #1482.
Diffstat (limited to 'libavcodec/indeo3.c')
-rw-r--r--libavcodec/indeo3.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c
index b74fcf7c22..8e55fbe443 100644
--- a/libavcodec/indeo3.c
+++ b/libavcodec/indeo3.c
@@ -213,6 +213,7 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
int *width_tbl, width_tbl_arr[10];
const signed char *ref_vectors;
uint8_t *cur_frm_pos, *ref_frm_pos, *cp, *cp2;
+ uint8_t *cur_end = cur + width*height + width;
uint32_t *cur_lp, *ref_lp;
const uint32_t *correction_lp[2], *correctionloworder_lp[2], *correctionhighorder_lp[2];
uint8_t *correction_type_sp[2];
@@ -359,6 +360,8 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
k = *buf1++;
cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2];
ref_lp = ((uint32_t *)ref_frm_pos) + width_tbl[lp2];
+ if ((uint8_t *)cur_lp >= cur_end-3)
+ break;
switch(correction_type_sp[0][k]) {
case 0: