[vlc-commits] scene: Fix division by 0

Jean-Baptiste Kempf git at videolan.org
Mon Sep 2 17:48:49 CEST 2013


vlc/vlc-2.1 | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Sep  2 16:57:17 2013 +0200| [8a6d8eafc24a48f40e7e6631d6d1f7ebe36d9bb9] | committer: Jean-Baptiste Kempf

scene: Fix division by 0

Close #9291

(cherry picked from commit 92b27c22a4896ac6485140fbf4f0eba3c591a4dc)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/video_filter/scene.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/modules/video_filter/scene.c b/modules/video_filter/scene.c
index 3f71aaa..4f68a7e 100644
--- a/modules/video_filter/scene.c
+++ b/modules/video_filter/scene.c
@@ -30,6 +30,8 @@
 # include "config.h"
 #endif
 
+#include <limits.h>
+
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_block.h>
@@ -112,8 +114,8 @@ vlc_module_begin ()
                  REPLACE_TEXT, REPLACE_LONGTEXT, false )
 
     /* Snapshot method */
-    add_integer( CFG_PREFIX "ratio", 50,
-                 RATIO_TEXT, RATIO_LONGTEXT, false )
+    add_integer_with_range( CFG_PREFIX "ratio", 50, 1, INT_MAX,
+                            RATIO_TEXT, RATIO_LONGTEXT, false )
 
     set_callbacks( Create, Destroy )
 vlc_module_end ()
@@ -183,6 +185,8 @@ static int Create( vlc_object_t *p_this )
     p_sys->i_width = var_CreateGetInteger( p_this, CFG_PREFIX "width" );
     p_sys->i_height = var_CreateGetInteger( p_this, CFG_PREFIX "height" );
     p_sys->i_ratio = var_CreateGetInteger( p_this, CFG_PREFIX "ratio" );
+    if( p_sys->i_ratio <= 0)
+        p_sys->i_ratio = 1;
     p_sys->b_replace = var_CreateGetBool( p_this, CFG_PREFIX "replace" );
     p_sys->psz_prefix = var_CreateGetString( p_this, CFG_PREFIX "prefix" );
     p_sys->psz_path = var_GetNonEmptyString( p_this, CFG_PREFIX "path" );



More information about the vlc-commits mailing list