[vlc-commits] Qt4: avoid integer overflow on V4L2 slider min and max

Rémi Denis-Courmont git at videolan.org
Sat Oct 1 21:39:24 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Oct  1 22:38:12 2011 +0300| [f534e17d50903fb8e261cfecab1d68618690f910] | committer: Rémi Denis-Courmont

Qt4: avoid integer overflow on V4L2 slider min and max

Ideally, we should subclass QAbstractSpinBox to support 64-bits values.
But in the mean time, lets at least support the int32_t range.

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

 modules/gui/qt4/components/extended_panels.cpp |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/modules/gui/qt4/components/extended_panels.cpp b/modules/gui/qt4/components/extended_panels.cpp
index b83dac6..de2efe1 100644
--- a/modules/gui/qt4/components/extended_panels.cpp
+++ b/modules/gui/qt4/components/extended_panels.cpp
@@ -765,15 +765,18 @@ void ExtV4l2::Refresh( void )
                         vlc_value_t val2;
                         var_Change( p_obj, psz_var, VLC_VAR_GETMIN,
                                     &val2, NULL );
+                        if( val2.i_int < INT_MIN )
+                            val2.i_int = INT_MIN; /* FIXME */
                         slider->setMinimum( val2.i_int );
                         var_Change( p_obj, psz_var, VLC_VAR_GETMAX,
                                     &val2, NULL );
+                        if( val2.i_int > INT_MAX )
+                            val2.i_int = INT_MAX; /* FIXME */
                         slider->setMaximum( val2.i_int );
                         if( !var_Change( p_obj, psz_var, VLC_VAR_GETSTEP,
                                          &val2, NULL ) )
                             slider->setSingleStep( val2.i_int );
                         slider->setValue( i_val );
-
                         CONNECT( slider, valueChanged( int ), this,
                                  ValueChange( int ) );
                         hlayout->addWidget( slider );



More information about the vlc-commits mailing list