diff options
author | Andreas Rheinhardt <[email protected]> | 2021-10-01 15:54:48 +0200 |
---|---|---|
committer | Andreas Rheinhardt <[email protected]> | 2022-01-11 15:15:53 +0100 |
commit | fd5726a2261b52dde878cb35f8a0781d9bd714bc (patch) | |
tree | 31660fa16bf47197dab16f84a6beb791285f04ca /libavformat/subtitles.c | |
parent | 91b06840247273755630e75f76b9931467847ee8 (diff) |
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 <[email protected]>
Signed-off-by: Andreas Rheinhardt <[email protected]>
(cherry picked from commit 8766361fc16b6d25ee8be880bf55c9761490cb99)
Diffstat (limited to 'libavformat/subtitles.c')
-rw-r--r-- | libavformat/subtitles.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c index 6368ec74f9..576b2c49f1 100644 --- a/libavformat/subtitles.c +++ b/libavformat/subtitles.c @@ -418,6 +418,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) |