mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-12 18:10:13 +01:00
indeo5: check motion vectors.
fixes out of frame reading Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@@ -450,7 +450,7 @@ static int decode_mb_info(IVI5DecContext *ctx, IVIBandDesc *band,
|
||||
IVITile *tile, AVCodecContext *avctx)
|
||||
{
|
||||
int x, y, mv_x, mv_y, mv_delta, offs, mb_offset,
|
||||
mv_scale, blks_per_mb;
|
||||
mv_scale, blks_per_mb, s;
|
||||
IVIMbInfo *mb, *ref_mb;
|
||||
int row_offset = band->mb_size * band->pitch;
|
||||
|
||||
@@ -550,6 +550,15 @@ static int decode_mb_info(IVI5DecContext *ctx, IVIBandDesc *band,
|
||||
}
|
||||
}
|
||||
|
||||
s= band->is_halfpel;
|
||||
if (mb->type)
|
||||
if ( x + (mb->mv_x >>s) + (y+ (mb->mv_y >>s))*band->pitch < 0 ||
|
||||
x + ((mb->mv_x+s)>>s) + band->mb_size - 1
|
||||
+ (y+band->mb_size - 1 +((mb->mv_y+s)>>s))*band->pitch > band->bufsize - 1) {
|
||||
av_log(avctx, AV_LOG_ERROR, "motion vector %d %d outside reference\n", x*s + mb->mv_x, y*s + mb->mv_y);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
mb++;
|
||||
if (ref_mb)
|
||||
ref_mb++;
|
||||
|
||||
Reference in New Issue
Block a user