[vlc-devel] commit: Fixed division by 0 with invalid files in avformat wrapper. ( Laurent Aimar )

git version control git at videolan.org
Wed Feb 24 00:14:14 CET 2010


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Tue Feb 23 22:50:19 2010 +0100| [db449895e90d2fd0dbedd7620d174cf70e00ea40] | committer: Laurent Aimar 

Fixed division by 0 with invalid files in avformat wrapper.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=db449895e90d2fd0dbedd7620d174cf70e00ea40
---

 modules/demux/avformat/demux.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index c407813..9472b5d 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -498,6 +498,12 @@ static int Demux( demux_t *p_demux )
         return 1;
     }
     const AVStream *p_stream = p_sys->ic->streams[pkt.stream_index];
+    if( p_stream->time_base.den <= 0 )
+    {
+        msg_Warn( p_demux, "Invalid time base for the stream %d", pkt.stream_index );
+        av_free_packet( &pkt );
+        return 1;
+    }
     if( p_stream->codec->codec_id == CODEC_ID_SSA )
     {
         p_frame = BuildSsaFrame( &pkt, p_sys->i_ssa_order++ );




More information about the vlc-devel mailing list