From: Clément Bœsch Date: Sun, 8 Sep 2013 14:17:46 +0000 (+0200) Subject: avformat/srtdec: skip initial random line breaks. X-Git-Tag: n2.1~1037 X-Git-Url: http://git.videolan.org/?p=ffmpeg.git;a=commitdiff_plain;h=cfcd55db164e0acc0c30b2cf084e6eebe9741d34 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. --- diff --git a/libavformat/srtdec.c b/libavformat/srtdec.c index dbf1866202..ac783d9e3b 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)