[FFmpeg-cvslog] avformat/subtitles: Honour ff_subtitles_read_line() documentation

Andreas Rheinhardt git at videolan.org
Sat Oct 2 18:45:17 EEST 2021


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Fri Oct  1 15:54:48 2021 +0200| [8766361fc16b6d25ee8be880bf55c9761490cb99] | committer: Andreas Rheinhardt

avformat/subtitles: Honour ff_subtitles_read_line() documentation

It claims to always zero-terminate its buffer like snprintf(),
yet it does it not on EOF. Because of this the mcc demuxer
used uninitialized values when reading an empty input file.

Reviewed-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

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

 libavformat/subtitles.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c
index c6701c6a60..3ba5e2b217 100644
--- a/libavformat/subtitles.c
+++ b/libavformat/subtitles.c
@@ -437,6 +437,7 @@ ptrdiff_t ff_subtitles_read_line(FFTextReader *tr, char *buf, size_t size)
     size_t cur = 0;
     if (!size)
         return 0;
+    buf[0] = '\0';
     while (cur + 1 < size) {
         unsigned char c = ff_text_r8(tr);
         if (!c)



More information about the ffmpeg-cvslog mailing list