diff mbox series

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

Message ID 20201017073745.403153-2-andreas.rheinhardt@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel,v3,1/8] avcodec/movtextenc: Fix potential use of uninitialized value | expand

Checks

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

Commit Message

Andreas Rheinhardt Oct. 17, 2020, 7:37 a.m. UTC
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@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 mbox series

Patch

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;