OSDN Git Service

cinepak: Fix division by zero, ask for sample if encoded_buf_size is 0
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 16 Nov 2011 14:10:26 +0000 (15:10 +0100)
committerMartin Storsjö <martin@martin.st>
Fri, 18 Nov 2011 09:35:56 +0000 (11:35 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Martin Storsjö <martin@martin.st>
libavcodec/cinepak.c

index f8b5352..0dbdeab 100644 (file)
@@ -330,6 +330,10 @@ static int cinepak_decode (CinepakContext *s)
 
     /* if this is the first frame, check for deviant Sega FILM data */
     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 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.