cinepak: Fix division by zero, ask for sample if encoded_buf_size is 0

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Martin Storsjö <martin@martin.st>
pull/2/head
Michael Niedermayer 13 years ago committed by Martin Storsjö
parent 795d9594cf
commit b55aa7df6b
  1. 4
      libavcodec/cinepak.c

@ -330,6 +330,10 @@ static int cinepak_decode (CinepakContext *s)
/* if this is the first frame, check for deviant Sega FILM data */ /* if this is the first frame, check for deviant Sega FILM data */
if (s->sega_film_skip_bytes == -1) { if (s->sega_film_skip_bytes == -1) {
if (!encoded_buf_size) {
av_log_ask_for_sample(s->avctx, "encoded_buf_size is 0");
return -1;
}
if (encoded_buf_size != s->size && (s->size % encoded_buf_size) != 0) { if (encoded_buf_size != s->size && (s->size % encoded_buf_size) != 0) {
/* If the encoded frame size differs from the frame size as indicated /* If the encoded frame size differs from the frame size as indicated
* by the container file, this data likely comes from a Sega FILM/CPK file. * by the container file, this data likely comes from a Sega FILM/CPK file.

Loading…
Cancel
Save