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
... ...
@@ -347,7 +347,7 @@ static int ffm2_read_header(AVFormatContext *s)
347 347
     }
348 348
 
349 349
     /* get until end of block reached */
350
-    while ((avio_tell(pb) % ffm->packet_size) != 0)
350
+    while ((avio_tell(pb) % ffm->packet_size) != 0 && !pb->eof_reached)
351 351
         avio_r8(pb);
352 352
 
353 353
     /* init packet demux */
... ...
@@ -477,7 +477,7 @@ static int ffm_read_header(AVFormatContext *s)
477 477
     }
478 478
 
479 479
     /* get until end of block reached */
480
-    while ((avio_tell(pb) % ffm->packet_size) != 0)
480
+    while ((avio_tell(pb) % ffm->packet_size) != 0 && !pb->eof_reached)
481 481
         avio_r8(pb);
482 482
 
483 483
     /* init packet demux */