Commit 8435bca0 authored by Luca Barbato's avatar Luca Barbato

indeo4: Do not access missing reference MV

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
parent 031be5b4
...@@ -459,7 +459,7 @@ static int decode_mb_info(IVI45DecContext *ctx, IVIBandDesc *band, ...@@ -459,7 +459,7 @@ static int decode_mb_info(IVI45DecContext *ctx, IVIBandDesc *band,
} }
mb->mv_x = mb->mv_y = 0; /* no motion vector coded */ mb->mv_x = mb->mv_y = 0; /* no motion vector coded */
if (band->inherit_mv) { if (band->inherit_mv && ref_mb) {
/* motion vector inheritance */ /* motion vector inheritance */
if (mv_scale) { if (mv_scale) {
mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale); mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale);
...@@ -471,7 +471,10 @@ static int decode_mb_info(IVI45DecContext *ctx, IVIBandDesc *band, ...@@ -471,7 +471,10 @@ static int decode_mb_info(IVI45DecContext *ctx, IVIBandDesc *band,
} }
} else { } else {
if (band->inherit_mv) { if (band->inherit_mv) {
mb->type = ref_mb->type; /* copy mb_type from corresponding reference mb */ /* copy mb_type from corresponding reference mb */
if (!ref_mb)
return AVERROR_INVALIDDATA;
mb->type = ref_mb->type;
} else if (ctx->frame_type == FRAMETYPE_INTRA || } else if (ctx->frame_type == FRAMETYPE_INTRA ||
ctx->frame_type == FRAMETYPE_INTRA1) { ctx->frame_type == FRAMETYPE_INTRA1) {
mb->type = 0; /* mb_type is always INTRA for intra-frames */ mb->type = 0; /* mb_type is always INTRA for intra-frames */
...@@ -495,6 +498,7 @@ static int decode_mb_info(IVI45DecContext *ctx, IVIBandDesc *band, ...@@ -495,6 +498,7 @@ static int decode_mb_info(IVI45DecContext *ctx, IVIBandDesc *band,
mb->mv_x = mb->mv_y = 0; /* there is no motion vector in intra-macroblocks */ mb->mv_x = mb->mv_y = 0; /* there is no motion vector in intra-macroblocks */
} else { } else {
if (band->inherit_mv) { if (band->inherit_mv) {
if (ref_mb)
/* motion vector inheritance */ /* motion vector inheritance */
if (mv_scale) { if (mv_scale) {
mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale); mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale);
......
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