flashsv: Check diff_start diff_height values

Fix out of array accesses.

Found-by: ami_stuff
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
pull/45/head
Michael Niedermayer 11 years ago committed by Luca Barbato
parent 4a64e67988
commit 57070b1468
  1. 6
      libavcodec/flashsv.c

@ -383,6 +383,12 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
} }
s->diff_start = get_bits(&gb, 8); s->diff_start = get_bits(&gb, 8);
s->diff_height = get_bits(&gb, 8); s->diff_height = get_bits(&gb, 8);
if (s->diff_start + s->diff_height > cur_blk_height) {
av_log(avctx, AV_LOG_ERROR,
"Block parameters invalid: %d + %d > %d\n",
s->diff_start, s->diff_height, cur_blk_height);
return AVERROR_INVALIDDATA;
}
av_log(avctx, AV_LOG_DEBUG, av_log(avctx, AV_LOG_DEBUG,
"%dx%d diff start %d height %d\n", "%dx%d diff start %d height %d\n",
i, j, s->diff_start, s->diff_height); i, j, s->diff_start, s->diff_height);

Loading…
Cancel
Save