]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/cinepak.c
extract duration if available
[ffmpeg] / libavcodec / cinepak.c
index df7aa0e480b9ede8b106993f6a87b87c02481a58..3b00a1605d34c2b4453fc729766bf1a467247703 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;
 
@@ -365,7 +368,7 @@ static int cinepak_decode_init(AVCodecContext *avctx)
     s->height = (avctx->height + 3) & ~3;
 
     // check for paletted data
-    if (avctx->palctrl == NULL) {
+    if ((avctx->palctrl == NULL) || (avctx->bits_per_sample == 40)) {
         s->palette_video = 0;
         avctx->pix_fmt = PIX_FMT_YUV420P;
     } else {