[FFmpeg-devel] [PATCH v3 2/8] avcodec/movtextenc: Reset array counter after freeing array

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Sat Oct 17 10:37:39 EEST 2020


Otherwise the mov_text encoder 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>
---
The earlier commit message claimed to be about a muxer in
avcodec/movtextdec.

I still don't know whether the STYL_BOX flag should be reset or not.

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

diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c
index 11db240ab7..81e8c2e802 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