[FFmpeg-devel] [PATCH 1/2] avcodec/movtextdec: Reset array counter after freeing array

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Fri Oct 16 17:40:34 EEST 2020


Otherwise the mov_text muxer can segfault when given subtitles with more
than one AVSubtitleRect if one of the first nb_rects - 1 rects contained
a style attribute.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
I wonder whether we should also reset the STYL_BOX flag of s->box_flags.

 libavcodec/movtextenc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c
index 67d29a09ca..3cf308aac8 100644
--- a/libavcodec/movtextenc.c
+++ b/libavcodec/movtextenc.c
@@ -102,6 +102,7 @@ static void mov_text_cleanup(MovTextContext *s)
             av_freep(&s->style_attributes[j]);
         }
         av_freep(&s->style_attributes);
+        s->count = 0;
     }
     if (s->style_attributes_temp) {
         *s->style_attributes_temp = s->d;
-- 
2.25.1



More information about the ffmpeg-devel mailing list