diff --git a/libavcodec/fic.c b/libavcodec/fic.c index 7de13acfa5..8c4c4814db 100644 --- a/libavcodec/fic.c +++ b/libavcodec/fic.c @@ -386,6 +386,8 @@ static int fic_decode_frame(AVCodecContext *avctx, void *data, slice_h = FFALIGN(avctx->height - ctx->slice_h * (nslices - 1), 16); } else { slice_size = AV_RB32(src + tsize + FIC_HEADER_SIZE + slice * 4 + 4); + if (slice_size < slice_off) + return AVERROR_INVALIDDATA; } if (slice_size < slice_off || slice_size > msize)