]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/movtextenc: Reset array counter after freeing array
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 16 Oct 2020 11:47:56 +0000 (13:47 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 19 Oct 2020 19:36:57 +0000 (21:36 +0200)
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@overt.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/movtextenc.c

index 11db240ab7c2164464b807095152c19faf1498f0..81e8c2e8026bffa26b98a9de49513d0b955ab849 100644 (file)
@@ -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;