[FFmpeg-cvslog] avformat/img2dec: fix infinite loop

Michael Niedermayer git at videolan.org
Sat Mar 10 03:48:57 EET 2018


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sat Mar 10 01:40:36 2018 +0100| [a6cba062051f345e8ebfdff34aba071ed73d923f] | committer: Michael Niedermayer

avformat/img2dec: fix infinite loop

Fixes: kira-poc

Found-by: Kira <kira_cxy at foxmail.com>
Change suggested by Kira
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/img2dec.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index 62db0d92cf..f3f52c83b3 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -878,10 +878,14 @@ static int svg_probe(AVProbeData *p)
 {
     const uint8_t *b = p->buf;
     const uint8_t *end = p->buf + p->buf_size;
+
     if (memcmp(p->buf, "<?xml", 5))
         return 0;
     while (b < end) {
-        b += ff_subtitles_next_line(b);
+        int inc = ff_subtitles_next_line(b);
+        if (!inc)
+            break;
+        b += inc;
         if (b >= end - 4)
             return 0;
         if (!memcmp(b, "<svg", 4))



More information about the ffmpeg-cvslog mailing list