fix infinite loop (suggested change by rjayne at convera dot com)
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 11 Jul 2005 22:34:34 +0000 (22:34 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 11 Jul 2005 22:34:34 +0000 (22:34 +0000)
fixes bug #1160195

Originally committed as revision 4434 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/cinepak.c

index 3c560fd..3b00a16 100644 (file)
@@ -274,6 +274,9 @@ static int cinepak_decode_strip (CinepakContext *s,
     while ((data + 4) <= eod) {
         chunk_id   = BE_16 (&data[0]);
         chunk_size = BE_16 (&data[2]) - 4;
+        if(chunk_size < 0)
+            return -1;
+
         data      += 4;
         chunk_size = ((data + chunk_size) > eod) ? (eod - data) : chunk_size;