[vlc-commits] commit: Check rate value before using. (Antoine Cellerier )

git version control git at videolan.org
Tue Mar 2 22:55:29 CET 2010


vlc | branch: master | Antoine Cellerier <dionoea at videolan.org> | Tue Mar  2 22:56:59 2010 +0100| [56c907c617b9e895e4c348cf35473227813ff482] | committer: Antoine Cellerier 

Check rate value before using.

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

 src/input/input.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index 495ae18..c100110 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -349,8 +349,13 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
     p_input->p->title = NULL;
     p_input->p->i_title_offset = p_input->p->i_seekpoint_offset = 0;
     p_input->p->i_state = INIT_S;
-    p_input->p->i_rate = INPUT_RATE_DEFAULT
-                         / var_InheritFloat( p_input, "rate" );
+    double f_rate = var_InheritFloat( p_input, "rate" );
+    if( f_rate <= 0. )
+    {
+        msg_Warn( p_input, "Negative or zero rate values are forbidden" );
+        f_rate = 1.;
+    }
+    p_input->p->i_rate = INPUT_RATE_DEFAULT / f_rate;
     p_input->p->b_recording = false;
     memset( &p_input->p->bookmark, 0, sizeof(p_input->p->bookmark) );
     TAB_INIT( p_input->p->i_bookmark, p_input->p->pp_bookmark );



More information about the vlc-commits mailing list