/* setup output and reference pointers */
offset_dst = (cell->ypos << 2) * plane->pitch + (cell->xpos << 2);
dst = plane->pixels[ctx->buf_sel] + offset_dst;
+ if(cell->mv_ptr){
mv_y = cell->mv_ptr[0];
mv_x = cell->mv_ptr[1];
+ }else
+ mv_x= mv_y= 0;
offset = offset_dst + mv_y * plane->pitch + mv_x;
src = plane->pixels[ctx->buf_sel ^ 1] + offset;
BUFFER_PRECHECK;
dyad1 = bytestream_get_byte(data_ptr);
dyad2 = code;
- if (dyad1 > delta_tab->num_dyads || dyad1 >= 248)
+ if (dyad1 >= delta_tab->num_dyads || dyad1 >= 248)
return IV3_BAD_DATA;
} else {
/* process QUADS */
ref_cell->width -= curr_cell.width;
}
- while (1) { /* loop until return */
+ while (get_bits_left(&ctx->gb) >= 2) { /* loop until return */
RESYNC_BITSTREAM;
switch (code = get_bits(&ctx->gb, 2)) {
case H_SPLIT:
av_log(avctx, AV_LOG_ERROR, "SkipCell procedure not implemented yet!\n");
CHECK_CELL
+ if (!curr_cell.mv_ptr)
+ return AVERROR_INVALIDDATA;
copy_cell(ctx, plane, &curr_cell);
return 0;
}
}
}//while
- return 0;
+ return AVERROR_INVALIDDATA;
}
int32_t strip_width)
{
Cell curr_cell;
- int num_vectors;
+ uint32_t num_vectors;
/* each plane data starts with mc_vector_count field, */
/* an optional array of motion vectors followed by the vq data */
num_vectors = bytestream_get_le32(&data);
+ if(num_vectors >= data_size/2)
+ return AVERROR_INVALIDDATA;
ctx->mc_vectors = num_vectors ? data : 0;
+ data += num_vectors * 2;
+ data_size-= num_vectors * 2;
/* init the bitreader */
- init_get_bits(&ctx->gb, &data[num_vectors * 2], data_size << 3);
+ init_get_bits(&ctx->gb, data, data_size << 3);
ctx->skip_bits = 0;
ctx->need_resync = 0;