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@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2021-10-01 15:54:48 +02:00
parent 2004d8d36d
commit 8766361fc1
1 changed files with 1 additions and 0 deletions

View File

@ -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)