[vlc-devel] commit: ogg: Fix a divide by zero. (Pierre d'Herbemont )

git version control git at videolan.org
Thu Oct 2 21:13:27 CEST 2008


vlc | branch: 0.9-bugfix | Pierre d'Herbemont <pdherbemont at videolan.org> | Sat Sep 27 19:44:39 2008 +0200| [fd282fab68fadeb48c23163af4407d8c3bd81073] | committer: Derk-Jan Hartman 

ogg: Fix a divide by zero.

Please review.

Spotted by llvm/clang checker.
(cherry picked from commit 15f7406ed966b9545e4fef5c38af73fa38aaff36)

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

 modules/mux/ogg.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/modules/mux/ogg.c b/modules/mux/ogg.c
index ed60f58..8a63fde 100644
--- a/modules/mux/ogg.c
+++ b/modules/mux/ogg.c
@@ -872,6 +872,9 @@ static void OggSetDate( block_t *p_og, mtime_t i_dts, mtime_t i_length )
     {
         i_count++;
     }
+
+    if( i_count == 0 ) return; /* ignore. */
+
     i_delta = i_length / i_count;
 
     for( p_tmp = p_og; p_tmp != NULL; p_tmp = p_tmp->p_next )




More information about the vlc-devel mailing list