diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c index 9982b5e966..f00bf21d47 100644 --- a/libavcodec/flashsv.c +++ b/libavcodec/flashsv.c @@ -387,6 +387,10 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data, } s->diff_start = 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\n"); + return AVERROR_INVALIDDATA; + } av_log(avctx, AV_LOG_DEBUG, "%dx%d diff start %d height %d\n", i, j, s->diff_start, s->diff_height);