[FFmpeg-cvslog] avformat/srtdec: more lenient first line probing

Clément Bœsch git at videolan.org
Fri Oct 9 22:01:25 CEST 2015


ffmpeg | branch: release/2.5 | Clément Bœsch <clement at stupeflix.com> | Thu Oct  1 11:48:45 2015 +0200| [2e575c1e8dd7ab5e050caf431693fbf8b69f2c7f] | committer: Carl Eugen Hoyos

avformat/srtdec: more lenient first line probing

Fixes Ticket #4898
(cherry picked from commit 7218352e0228028dfa009a3799ec93fd041065f1)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2e575c1e8dd7ab5e050caf431693fbf8b69f2c7f
---

 libavformat/srtdec.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/srtdec.c b/libavformat/srtdec.c
index b35e50f..7fee0fc 100644
--- a/libavformat/srtdec.c
+++ b/libavformat/srtdec.c
@@ -41,9 +41,11 @@ static int srt_probe(AVProbeData *p)
         ff_text_r8(&tr);
 
     /* Check if the first non-empty line is a number. We do not check what the
-     * number is because in practice it can be anything. */
+     * number is because in practice it can be anything.
+     * Also, that number can be followed by random garbage, so we can not
+     * unfortunately check that we only have a number. */
     if (ff_subtitles_read_line(&tr, buf, sizeof(buf)) < 0 ||
-        strtol(buf, &pbuf, 10) < 0 || *pbuf)
+        strtol(buf, &pbuf, 10) < 0)
         return 0;
 
     /* Check if the next line matches a SRT timestamp */



More information about the ffmpeg-cvslog mailing list