]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/dsicinav.c
sgidec: stop using deprecated avcodec_set_dimensions
[ffmpeg] / libavcodec / dsicinav.c
index 7b36742279371506f5ee05dc92551e8e72bea8ed..4d157b4655896e071bd1542fa70309fa5e53ddbc 100644 (file)
@@ -195,11 +195,13 @@ static void cin_decode_rle(const unsigned char *src, int src_size,
     while (src < src_end && dst < dst_end) {
         code = *src++;
         if (code & 0x80) {
+            if (src >= src_end)
+                break;
             len = code - 0x7F;
             memset(dst, *src++, FFMIN(len, dst_end - dst));
         } else {
             len = code + 1;
-            memcpy(dst, src, FFMIN(len, dst_end - dst));
+            memcpy(dst, src, FFMIN3(len, dst_end - dst, src_end - src));
             src += len;
         }
         dst += len;
@@ -241,6 +243,8 @@ static int cinvideo_decode_frame(AVCodecContext *avctx,
         }
     }
 
+    bitmap_frame_size = FFMIN(cin->bitmap_size, bitmap_frame_size);
+
     /* note: the decoding routines below assumes that
      * surface.width = surface.pitch */
     switch (bitmap_frame_type) {
@@ -380,6 +384,7 @@ static int cinaudio_decode_frame(AVCodecContext *avctx, void *data,
 
 AVCodec ff_dsicinvideo_decoder = {
     .name           = "dsicinvideo",
+    .long_name      = NULL_IF_CONFIG_SMALL("Delphine Software International CIN video"),
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_DSICINVIDEO,
     .priv_data_size = sizeof(CinVideoContext),
@@ -387,16 +392,15 @@ AVCodec ff_dsicinvideo_decoder = {
     .close          = cinvideo_decode_end,
     .decode         = cinvideo_decode_frame,
     .capabilities   = CODEC_CAP_DR1,
-    .long_name      = NULL_IF_CONFIG_SMALL("Delphine Software International CIN video"),
 };
 
 AVCodec ff_dsicinaudio_decoder = {
     .name           = "dsicinaudio",
+    .long_name      = NULL_IF_CONFIG_SMALL("Delphine Software International CIN audio"),
     .type           = AVMEDIA_TYPE_AUDIO,
     .id             = AV_CODEC_ID_DSICINAUDIO,
     .priv_data_size = sizeof(CinAudioContext),
     .init           = cinaudio_decode_init,
     .decode         = cinaudio_decode_frame,
     .capabilities   = CODEC_CAP_DR1,
-    .long_name      = NULL_IF_CONFIG_SMALL("Delphine Software International CIN audio"),
 };