OSDN Git Service

ffmdec: fix infinite loop at EOF
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Sun, 8 Mar 2015 22:31:48 +0000 (23:31 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 9 Mar 2015 02:14:16 +0000 (03:14 +0100)
If EOF is reached, while skipping bytes, avio_tell(pb) won't change
anymore, resulting in an infinite loop.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/ffmdec.c

index 280a24c..96527a3 100644 (file)
@@ -434,7 +434,7 @@ static int ffm2_read_header(AVFormatContext *s)
     }
 
     /* get until end of block reached */
-    while ((avio_tell(pb) % ffm->packet_size) != 0)
+    while ((avio_tell(pb) % ffm->packet_size) != 0 && !pb->eof_reached)
         avio_r8(pb);
 
     /* init packet demux */
@@ -561,7 +561,7 @@ static int ffm_read_header(AVFormatContext *s)
     }
 
     /* get until end of block reached */
-    while ((avio_tell(pb) % ffm->packet_size) != 0)
+    while ((avio_tell(pb) % ffm->packet_size) != 0 && !pb->eof_reached)
         avio_r8(pb);
 
     /* init packet demux */