[vlc-devel] [PATCH] input/control: fix off-by-one bounds check

Filip Roséen filip at atch.se
Wed Mar 1 09:52:04 CET 2017


The previous code would allow callers to get the title one past the
end of the array.
---
 src/input/control.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/input/control.c b/src/input/control.c
index e662a23cb0..f4781eb1a5 100644
--- a/src/input/control.c
+++ b/src/input/control.c
@@ -393,7 +393,7 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
             if ( *pi_title_to_fetch < 0 ) /* query current title if -1 */
                 *pi_title_to_fetch = var_GetInteger( p_input, "title" );
 
-            if( !priv->i_title || priv->i_title < *pi_title_to_fetch )
+            if( priv->i_title <= *pi_title_to_fetch )
             {
                 vlc_mutex_unlock( &priv->p_item->lock );
                 return VLC_EGENERIC;
-- 
2.12.0



More information about the vlc-devel mailing list