aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/img2dec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-03-10 01:40:36 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2018-06-18 01:16:03 +0200
commit3fa6e594a0f2575ddb6b2183961fde42ab5ab37b (patch)
tree0d715249174fca74bf253beb17ae75f7c7421076 /libavformat/img2dec.c
parent24c627a90099c74db713cd0682f7c11c6e27c50c (diff)
downloadffmpeg-3fa6e594a0f2575ddb6b2183961fde42ab5ab37b.tar.gz
avformat/img2dec: fix infinite loop
Fixes: kira-poc Found-by: Kira <kira_cxy@foxmail.com> Change suggested by Kira Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit a6cba062051f345e8ebfdff34aba071ed73d923f) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/img2dec.c')
-rw-r--r--libavformat/img2dec.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index ecf64eaffa..2585634e7c 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))