diff mbox series

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

Message ID 20201016144035.308668-1-andreas.rheinhardt@gmail.com
State Superseded
Headers show
Series [FFmpeg-devel,1/2] avcodec/movtextdec: Reset array counter after freeing array | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Oct. 16, 2020, 2:40 p.m. UTC
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@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 mbox series

Patch

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;