Commit 48df6a24 authored by Stefano Sabatini's avatar Stefano Sabatini

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.
parent 39d98346
...@@ -213,6 +213,7 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s, ...@@ -213,6 +213,7 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
int *width_tbl, width_tbl_arr[10]; int *width_tbl, width_tbl_arr[10];
const signed char *ref_vectors; const signed char *ref_vectors;
uint8_t *cur_frm_pos, *ref_frm_pos, *cp, *cp2; uint8_t *cur_frm_pos, *ref_frm_pos, *cp, *cp2;
uint8_t *cur_end = cur + width*height + width;
uint32_t *cur_lp, *ref_lp; uint32_t *cur_lp, *ref_lp;
const uint32_t *correction_lp[2], *correctionloworder_lp[2], *correctionhighorder_lp[2]; const uint32_t *correction_lp[2], *correctionloworder_lp[2], *correctionhighorder_lp[2];
uint8_t *correction_type_sp[2]; uint8_t *correction_type_sp[2];
...@@ -359,6 +360,8 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s, ...@@ -359,6 +360,8 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
k = *buf1++; k = *buf1++;
cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2]; cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2];
ref_lp = ((uint32_t *)ref_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]) { switch(correction_type_sp[0][k]) {
case 0: case 0:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment