Message ID | 20200620092700.21924-1-andreas.rheinhardt@gmail.com |
---|---|
State | Accepted |
Commit | 7447045cc0dacf9eedf230070c0675eecf546ff6 |
Headers | show |
Series | [FFmpeg-devel] avformat/webvttdec: Accept \r as newline | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | success | Make finished |
andriy/make_fate | success | Make fate finished |
Andreas Rheinhardt: > After parsing the end timestamp of a WebVTT cue block, the current code > skips everything after the start of the timestamp that is not a \t, ' ' > or \n and treats what is next as the start of a WebVTT cue settings list. > Yet if there is no such list, but a single \r, this will skip a part of > the cue payload (namely everything until the first occurence of \t, ' ' > or \n) and treat what has not been skipped as the beginning of the > WebVTT cue settings list that extends until the next \r or \n (or the > end). > > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> > --- > libavformat/webvttdec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavformat/webvttdec.c b/libavformat/webvttdec.c > index bd3d45b382..8d2fdfed37 100644 > --- a/libavformat/webvttdec.c > +++ b/libavformat/webvttdec.c > @@ -125,7 +125,7 @@ static int webvtt_read_header(AVFormatContext *s) > break; > > /* optional cue settings */ > - p += strcspn(p, "\n\t "); > + p += strcspn(p, "\n\r\t "); > while (*p == '\t' || *p == ' ') > p++; > settings = p; > Will apply tomorrow unless there are objections. - Andreas
diff --git a/libavformat/webvttdec.c b/libavformat/webvttdec.c index bd3d45b382..8d2fdfed37 100644 --- a/libavformat/webvttdec.c +++ b/libavformat/webvttdec.c @@ -125,7 +125,7 @@ static int webvtt_read_header(AVFormatContext *s) break; /* optional cue settings */ - p += strcspn(p, "\n\t "); + p += strcspn(p, "\n\r\t "); while (*p == '\t' || *p == ' ') p++; settings = p;
After parsing the end timestamp of a WebVTT cue block, the current code skips everything after the start of the timestamp that is not a \t, ' ' or \n and treats what is next as the start of a WebVTT cue settings list. Yet if there is no such list, but a single \r, this will skip a part of the cue payload (namely everything until the first occurence of \t, ' ' or \n) and treat what has not been skipped as the beginning of the WebVTT cue settings list that extends until the next \r or \n (or the end). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> --- libavformat/webvttdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)