]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/motionpixels.c
Check output buffer size in nellymoser decoder.
[ffmpeg] / libavcodec / motionpixels.c
index 01558ab95b3dbb7a907007b9e7c0fbd03bd10cba..160508007d71ae9de1d6ed318d9542de8ccf2b6c 100644 (file)
@@ -279,7 +279,8 @@ static int mp_decode_frame(AVCodecContext *avctx,
     if (sz == 0)
         goto end;
 
-    init_vlc(&mp->vlc, mp->max_codes_bits, mp->codes_count, &mp->codes[0].size, sizeof(HuffCode), 1, &mp->codes[0].code, sizeof(HuffCode), 4, 0);
+    if (init_vlc(&mp->vlc, mp->max_codes_bits, mp->codes_count, &mp->codes[0].size, sizeof(HuffCode), 1, &mp->codes[0].code, sizeof(HuffCode), 4, 0))
+        goto end;
     mp_decode_frame_helper(mp, &gb);
     free_vlc(&mp->vlc);
 
@@ -304,14 +305,13 @@ static av_cold int mp_decode_end(AVCodecContext *avctx)
 }
 
 AVCodec ff_motionpixels_decoder = {
-    "motionpixels",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MOTIONPIXELS,
-    sizeof(MotionPixelsContext),
-    mp_decode_init,
-    NULL,
-    mp_decode_end,
-    mp_decode_frame,
-    CODEC_CAP_DR1,
+    .name           = "motionpixels",
+    .type           = AVMEDIA_TYPE_VIDEO,
+    .id             = CODEC_ID_MOTIONPIXELS,
+    .priv_data_size = sizeof(MotionPixelsContext),
+    .init           = mp_decode_init,
+    .close          = mp_decode_end,
+    .decode         = mp_decode_frame,
+    .capabilities   = CODEC_CAP_DR1,
     .long_name = NULL_IF_CONFIG_SMALL("Motion Pixels video"),
 };