[FFmpeg-cvslog] avcodec/movtextenc: Reset array counter after freeing array

Andreas Rheinhardt git at videolan.org
Mon Oct 19 23:05:13 EEST 2020


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Fri Oct 16 13:47:56 2020 +0200| [8d4431955ccca80933a837e1bc7f44679039335b] | committer: Andreas Rheinhardt

avcodec/movtextenc: Reset array counter after freeing array

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.

Reviewed-by: Philip Langdale <philipl at overt.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8d4431955ccca80933a837e1bc7f44679039335b
---

 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;



More information about the ffmpeg-cvslog mailing list