Commit cf8e0c40b6 for ffmpeg

commit cf8e0c40b60b563ba2addf1dcb4fe3557143ab17
Author: Michael Niedermayer <michael@niedermayer.cc>
Date:   Wed Nov 11 15:24:55 2026 +0100

    avcodec/microdvddec: do not read the default tags beyond the extradata

    Fixes: out of array read
    Fixes: MSrIa2a0IU4Q

    Found during triage of the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25134

    Out of array read Replicated through API with ASAN

diff --git a/libavcodec/microdvddec.c b/libavcodec/microdvddec.c
index 95f0166bf4..4215f1e20b 100644
--- a/libavcodec/microdvddec.c
+++ b/libavcodec/microdvddec.c
@@ -28,6 +28,7 @@

 #include "libavutil/attributes.h"
 #include "libavutil/avstring.h"
+#include "libavutil/mem.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/bprint.h"
 #include "avcodec.h"
@@ -342,7 +343,11 @@ static av_cold int microdvd_init(AVCodecContext *avctx)
     av_bprintf(&font_buf, "%s", ASS_DEFAULT_FONT);

     if (avctx->extradata) {
-        microdvd_load_tags(tags, avctx->extradata);
+        char *default_tags = av_strndup(avctx->extradata, avctx->extradata_size);
+
+        if (!default_tags)
+            return AVERROR(ENOMEM);
+        microdvd_load_tags(tags, default_tags);
         for (i = 0; i < sizeof(MICRODVD_TAGS) - 1; i++) {
             switch (av_tolower(tags[i].key)) {
             case 'y':
@@ -368,6 +373,7 @@ static av_cold int microdvd_init(AVCodecContext *avctx)
                 break;
             }
         }
+        av_free(default_tags);
     }
     return ff_ass_subtitle_header(avctx, font_buf.str, font_size, color,
                                   ASS_DEFAULT_BACK_COLOR, bold, italic,