Commit 4b7fa553 authored by Hendrik Leppkes's avatar Hendrik Leppkes Committed by Derek Buitenhuis

indeo3: fix motion vector validation

The index of the motion vector has to be checked before being
multiplied by 2 for the array index.
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
Signed-off-by: 's avatarDerek Buitenhuis <derek.buitenhuis@gmail.com>
parent ff80c682
...@@ -773,12 +773,12 @@ static int parse_bintree(Indeo3DecodeContext *ctx, AVCodecContext *avctx, ...@@ -773,12 +773,12 @@ static int parse_bintree(Indeo3DecodeContext *ctx, AVCodecContext *avctx,
/* get motion vector index and setup the pointer to the mv set */ /* get motion vector index and setup the pointer to the mv set */
if (!ctx->need_resync) if (!ctx->need_resync)
ctx->next_cell_data = &ctx->gb.buffer[(get_bits_count(&ctx->gb) + 7) >> 3]; ctx->next_cell_data = &ctx->gb.buffer[(get_bits_count(&ctx->gb) + 7) >> 3];
mv_idx = *(ctx->next_cell_data++) << 1; mv_idx = *(ctx->next_cell_data++);
if (mv_idx >= ctx->num_vectors) { if (mv_idx >= ctx->num_vectors) {
av_log(avctx, AV_LOG_ERROR, "motion vector index out of range\n"); av_log(avctx, AV_LOG_ERROR, "motion vector index out of range\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
curr_cell.mv_ptr = &ctx->mc_vectors[mv_idx]; curr_cell.mv_ptr = &ctx->mc_vectors[mv_idx << 1];
curr_cell.tree = 1; /* enter the VQ tree */ curr_cell.tree = 1; /* enter the VQ tree */
UPDATE_BITPOS(8); UPDATE_BITPOS(8);
} else { /* VQ tree DATA code */ } else { /* VQ tree DATA code */
......
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