]> git.sesse.net Git - ffmpeg/commit
avformat/tedcaptionsdec: Fix leak of AVBPrint upon error
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sun, 20 Sep 2020 14:16:51 +0000 (16:16 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sun, 20 Sep 2020 14:58:17 +0000 (16:58 +0200)
commit9f7e592df27bd96bdffae173e3462d0438aea120
treedfe21c1ee3925dc6b7a5c37f681b37161c58f0ca
parentb0dee629da132f31934d58104c209d1ab3c1cb79
avformat/tedcaptionsdec: Fix leak of AVBPrint upon error

The tedcaptions demuxer uses an AVBPrint whose string is not restricted
to its internal buffer; it therefore needs to be cleaned up, yet this is
not done on error, as parse_file() returned simply returned directly.
This is fixed by going to fail first in such cases.
Furthermore, there is also a second way how this string can leak: By
having more than one subtitle per subtitle block, as the new one simply
overwrites the old one in this case as the AVBPrint is initialized each
time upon encountering a subtitle line. The code has been modified to
simply append the new subtitle to the old one, so that the old one can't
leak any more.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/tedcaptionsdec.c