]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/bintext.c
Fix typo in v410 decoder.
[ffmpeg] / libavcodec / bintext.c
index 91167ba150bce5f71e5e23d524f4819c9e5e190a..d0b6cc07da39ee1909cde08f3b2d828ebbbecfdd 100644 (file)
@@ -54,6 +54,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
         s->font_height = p[0];
         s->flags = p[1];
         p += 2;
+        if(avctx->extradata_size < 2 + (!!(s->flags & BINTEXT_PALETTE))*3*16
+                                     + (!!(s->flags & BINTEXT_FONT))*s->font_height*256) {
+            av_log(avctx, AV_LOG_ERROR, "not enough extradata\n");
+            return AVERROR_INVALIDDATA;
+        }
     } else {
         s->font_height = 8;
         s->flags = 0;
@@ -210,6 +215,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
     return 0;
 }
 
+#if CONFIG_BINTEXT_DECODER
 AVCodec ff_bintext_decoder = {
     .name           = "bintext",
     .type           = AVMEDIA_TYPE_VIDEO,
@@ -219,9 +225,10 @@ AVCodec ff_bintext_decoder = {
     .close          = decode_end,
     .decode         = decode_frame,
     .capabilities   = CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Binary text"),
+    .long_name      = NULL_IF_CONFIG_SMALL("Binary text"),
 };
-
+#endif
+#if CONFIG_XBIN_DECODER
 AVCodec ff_xbin_decoder = {
     .name           = "xbin",
     .type           = AVMEDIA_TYPE_VIDEO,
@@ -231,9 +238,10 @@ AVCodec ff_xbin_decoder = {
     .close          = decode_end,
     .decode         = decode_frame,
     .capabilities   = CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("eXtended BINary text"),
+    .long_name      = NULL_IF_CONFIG_SMALL("eXtended BINary text"),
 };
-
+#endif
+#if CONFIG_IDF_DECODER
 AVCodec ff_idf_decoder = {
     .name           = "idf",
     .type           = AVMEDIA_TYPE_VIDEO,
@@ -243,5 +251,6 @@ AVCodec ff_idf_decoder = {
     .close          = decode_end,
     .decode         = decode_frame,
     .capabilities   = CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("iCEDraw text"),
+    .long_name      = NULL_IF_CONFIG_SMALL("iCEDraw text"),
 };
+#endif