[vlc-commits] demux: ts: fix divbyzero

Francois Cartegnie git at videolan.org
Sun Jan 24 01:24:20 CET 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Jan 21 23:42:16 2016 +0100| [aafc80c09e8bdc74152c9e972593df89015a5057] | committer: Francois Cartegnie

demux: ts: fix divbyzero

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

 modules/demux/mpeg/ts.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index e132298..4574069 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -1531,8 +1531,11 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             i_length += p_pmt->pcr.i_pcroffset;
             double i_pos = TimeStampWrapAround( p_pmt,
                                                 p_pmt->pcr.i_current ) - p_pmt->pcr.i_first;
-            *pf = i_pos / i_length;
-            return VLC_SUCCESS;
+            if( i_length > 0 )
+            {
+                *pf = i_pos / i_length;
+                return VLC_SUCCESS;
+            }
         }
 
         if( (i64 = stream_Size( p_sys->stream) ) > 0 )



More information about the vlc-commits mailing list