avformat/aviobuf: Fix infinite loop in ff_get_line()
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 3 Dec 2014 18:05:56 +0000 (19:05 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 20 Dec 2014 01:25:54 +0000 (02:25 +0100)
Fixes ticket4152

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit eac5c7b8377f3f0e8262ab44e5ccb2c7ed060cdd)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/aviobuf.c

index 9795ba4..b1752cd 100644 (file)
@@ -674,7 +674,7 @@ int ff_get_line(AVIOContext *s, char *buf, int maxlen)
         if (c && i < maxlen-1)
             buf[i++] = c;
     } while (c != '\n' && c != '\r' && c);
-    if (c == '\r' && avio_r8(s) != '\n')
+    if (c == '\r' && avio_r8(s) != '\n' && !avio_feof(s))
         avio_skip(s, -1);
 
     buf[i] = 0;