aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorClément Bœsch <u@pkh.me>2013-09-08 16:17:46 +0200
committerAlexander Strasser <eclipse7@gmx.net>2013-09-16 21:39:33 +0200
commita0779a2ee504e9f38cab91296ba96fa189804f9b (patch)
tree8da42373ce6bbb862da885fd451dce807f57d0b0 /libavformat
parentb4f90013ab4f35f9cd0086193becffbe3413da08 (diff)
downloadffmpeg-a0779a2ee504e9f38cab91296ba96fa189804f9b.tar.gz
avformat/srtdec: skip initial random line breaks.
I found a bunch of (recent) SRT files in the wild with 3 to 10 line breaks at the beginning. (cherry picked from commit cfcd55db164e0acc0c30b2cf084e6eebe9741d34) Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/srtdec.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/srtdec.c b/libavformat/srtdec.c
index 76e06e4165..6b60052148 100644
--- a/libavformat/srtdec.c
+++ b/libavformat/srtdec.c
@@ -37,6 +37,8 @@ static int srt_probe(AVProbeData *p)
if (AV_RB24(ptr) == 0xEFBBBF)
ptr += 3; /* skip UTF-8 BOM */
+ while (*ptr == '\r' || *ptr == '\n')
+ ptr++;
for (i=0; i<2; i++) {
if ((num == i || num + 1 == i)
&& sscanf(ptr, "%*d:%*2d:%*2d%*1[,.]%*3d --> %*d:%*2d:%*2d%*1[,.]%3d", &v) == 1)