summaryrefslogtreecommitdiff
path: root/libavformat/webvttdec.c
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2023-06-21 20:06:09 +0200
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2023-07-29 16:05:29 +0200
commitc0f867bf503e79eba8ee52e1ac53322f88ec2929 (patch)
treed5c599f83135967be877d0a56daeca5b25df6398 /libavformat/webvttdec.c
parentdcff15692dff4c55827d640f1d5d07eb255a5a6a (diff)
libavformat: fix incorrect handling of incomplete AVBPrint.
Change some internal APIs a bit to make it harder to make such mistakes. In particular, have the read chunk functions return an error when the result is incomplete. This might be less flexible, but since there has been no use-case for that so far, avoiding coding mistakes seems better. Add a function to queue a AVBPrint directly (ff_subtitles_queue_insert_bprint). Also fixes a leak in lrcdec when ff_subtitles_queue_insert fails. Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Diffstat (limited to 'libavformat/webvttdec.c')
-rw-r--r--libavformat/webvttdec.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/webvttdec.c b/libavformat/webvttdec.c
index 52320ba7d1..0b2fc77168 100644
--- a/libavformat/webvttdec.c
+++ b/libavformat/webvttdec.c
@@ -81,7 +81,9 @@ static int webvtt_read_header(AVFormatContext *s)
size_t identifier_len, settings_len;
int64_t ts_start, ts_end;
- ff_subtitles_read_chunk(s->pb, &cue);
+ res = ff_subtitles_read_chunk(s->pb, &cue);
+ if (res < 0)
+ goto end;
if (!cue.len)
break;