[vlc-devel] [PATCH 1/3] zvbi: Fail probe if vbi-page is incorrect

Thomas Guillem thomas at gllm.fr
Thu Mar 23 11:31:12 CET 2017


---
 modules/codec/zvbi.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/modules/codec/zvbi.c b/modules/codec/zvbi.c
index 430a6ba42d..8578f2fca2 100644
--- a/modules/codec/zvbi.c
+++ b/modules/codec/zvbi.c
@@ -208,6 +208,13 @@ static int Open( vlc_object_t *p_this )
     if( p_dec->fmt_in.i_codec != VLC_CODEC_TELETEXT )
         return VLC_EGENERIC;
 
+    int i_page = var_CreateGetInteger( p_dec, "vbi-page" );
+    if( i_page < 0 || i_page > 999 )
+    {
+        msg_Warn( p_dec, "Invalid vbi-page");
+        return VLC_EGENERIC;
+    }
+
     p_sys = p_dec->p_sys = calloc( 1, sizeof(decoder_sys_t) );
     if( p_sys == NULL )
         return VLC_ENOMEM;
@@ -245,7 +252,7 @@ static int Open( vlc_object_t *p_this )
                                 0 , EventHandler, p_dec );
 
     /* Create the var on vlc_global. */
-    p_sys->i_wanted_page = var_CreateGetInteger( p_dec, "vbi-page" );
+    p_sys->i_wanted_page = i_page;
     var_AddCallback( p_dec, "vbi-page", RequestPage, p_sys );
 
     /* Check if the Teletext track has a known "initial page". */
-- 
2.11.0



More information about the vlc-devel mailing list