[FFmpeg-devel] [PATCH 6/8] ffmdec: fix infinite loop at EOF

2015-03-08 Thread Andreas Cadhalpun

Hi,

if ffm files are shorter than expected, these loops never finish. 
Attached patch fixes that.


Best regards,
Andreas
>From 697ac779497e26e27e6337205e37a371020add1e Mon Sep 17 00:00:00 2001
From: Andreas Cadhalpun 
Date: Sun, 8 Mar 2015 23:31:48 +0100
Subject: [PATCH 6/8] 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 
---
 libavformat/ffmdec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
index 9cbd20c..60df51d 100644
--- a/libavformat/ffmdec.c
+++ b/libavformat/ffmdec.c
@@ -460,7 +460,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 */
@@ -592,7 +592,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 */
-- 
2.1.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 6/8] ffmdec: fix infinite loop at EOF

2015-03-08 Thread Michael Niedermayer
On Mon, Mar 09, 2015 at 12:04:37AM +0100, Andreas Cadhalpun wrote:
> Hi,
> 
> if ffm files are shorter than expected, these loops never finish.
> Attached patch fixes that.
> 
> Best regards,
> Andreas

>  ffmdec.c |4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 15281e8220cd5aef8606a499bb51569cbc6dfe49  
> 0006-ffmdec-fix-infinite-loop-at-EOF.patch
> From 697ac779497e26e27e6337205e37a371020add1e Mon Sep 17 00:00:00 2001
> From: Andreas Cadhalpun 
> Date: Sun, 8 Mar 2015 23:31:48 +0100
> Subject: [PATCH 6/8] 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.

applied

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel