diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c index 9b0077402f..d26c505222 100644 --- a/libavcodec/cinepak.c +++ b/libavcodec/cinepak.c @@ -353,6 +353,13 @@ static int cinepak_predecode_check (CinepakContext *s) if (s->size < 10 + s->sega_film_skip_bytes + num_strips * 12) return AVERROR_INVALIDDATA; + if (num_strips) { + uint8_t *data = s->data + 10 + s->sega_film_skip_bytes; + int strip_size = AV_RB24 (data + 1); + if (strip_size < 12 || strip_size > encoded_buf_size) + return AVERROR_INVALIDDATA; + } + return 0; }