diff --git a/libavcodec/dsicinav.c b/libavcodec/dsicinav.c index 643aed946b..d8c99b508e 100644 --- a/libavcodec/dsicinav.c +++ b/libavcodec/dsicinav.c @@ -216,6 +216,8 @@ static int cinvideo_decode_frame(AVCodecContext *avctx, bitmap_frame_size = buf_size - 4; /* handle palette */ + if (bitmap_frame_size < palette_colors_count * (3 + (palette_type != 0))) + return AVERROR_INVALIDDATA; if (palette_type == 0) { for (i = 0; i < palette_colors_count; ++i) { cin->palette[i] = bytestream_get_le24(&buf);