Browse code

ffmdec: fix infinite loop at EOF

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>
(cherry picked from commit 6fa98822eba501a4898fdec5b75acd3026201005)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Andreas Cadhalpun authored on 2015/03/09 07:31:48
Showing 1 changed files
... ...
@@ -434,7 +434,7 @@ static int ffm2_read_header(AVFormatContext *s)
434 434
     }
435 435
 
436 436
     /* get until end of block reached */
437
-    while ((avio_tell(pb) % ffm->packet_size) != 0)
437
+    while ((avio_tell(pb) % ffm->packet_size) != 0 && !pb->eof_reached)
438 438
         avio_r8(pb);
439 439
 
440 440
     /* init packet demux */
... ...
@@ -561,7 +561,7 @@ static int ffm_read_header(AVFormatContext *s)
561 561
     }
562 562
 
563 563
     /* get until end of block reached */
564
-    while ((avio_tell(pb) % ffm->packet_size) != 0)
564
+    while ((avio_tell(pb) % ffm->packet_size) != 0 && !pb->eof_reached)
565 565
         avio_r8(pb);
566 566
 
567 567
     /* init packet demux */